add derives
Some checks failed
Rust / build-gnu-apt (pull_request) Successful in 2m5s
Rust / build-size-gnu-unstable (pull_request) Failing after 2m48s

This commit is contained in:
Vinzenz Schroeter 2025-06-26 23:22:18 +02:00
parent c65b735f57
commit 363609c663
15 changed files with 55 additions and 101 deletions

View file

@ -1,15 +1,10 @@
use crate::{
commands::{wrap_command, wrap_origin_accessors},
macros::wrap,
};
use crate::macros::wrap;
use servicepoint::{Bitmap, BitmapCommand, CompressionCode, Origin};
use std::ptr::NonNull;
wrap_command!(Bitmap);
wrap_origin_accessors!(BitmapCommand);
wrap! {
BitmapCommand {
derives: crate::commands::derive_command[Bitmap], crate::commands::derive_origin_accessors;
properties:
prop bitmap: Bitmap { get mut; set move; };
prop compression: CompressionCode { get; set; };

View file

@ -1,13 +1,12 @@
use crate::{commands::wrap_command, macros::wrap};
use crate::macros::wrap;
use servicepoint::{
BinaryOperation, BitVecCommand, CompressionCode, DisplayBitVec, Offset,
};
use std::ptr::NonNull;
wrap_command!(BitVec);
wrap!(
BitVecCommand {
derives: crate::commands::derive_command[BitVec];
properties:
prop bitvec: DisplayBitVec { get mut; set move; };
prop offset: Offset { get; set; };

View file

@ -1,15 +1,10 @@
use crate::{
commands::{wrap_command, wrap_origin_accessors},
macros::wrap,
};
use crate::macros::wrap;
use servicepoint::{BrightnessGrid, BrightnessGridCommand, Origin};
use std::ptr::NonNull;
wrap_command!(BrightnessGrid);
wrap_origin_accessors!(BrightnessGridCommand);
wrap!(
BrightnessGridCommand {
derives: crate::commands::derive_command[BrightnessGrid], crate::commands::derive_origin_accessors;
properties:
prop grid: BrightnessGrid { get mut; set move; };
functions:

View file

@ -1,13 +1,11 @@
use crate::commands::wrap_command;
use servicepoint::{ClearCommand, FadeOutCommand, HardResetCommand};
macro_rules! wrap_cc_only {
($(#[$meta:meta])* $command:ident) => {
::paste::paste!{
wrap_command!($command);
$crate::macros::wrap!{
[< $command Command >] {
derives: $crate::commands::derive_command[$command];
functions:
$(#[$meta])*
///

View file

@ -1,15 +1,10 @@
use crate::{
commands::{wrap_command, wrap_origin_accessors},
macros::wrap,
};
use crate::macros::wrap;
use servicepoint::{CharGrid, CharGridCommand, Origin};
use std::ptr::NonNull;
wrap_command!(CharGrid);
wrap_origin_accessors!(CharGridCommand);
wrap!(
CharGridCommand {
derives: crate::commands::derive_command[CharGrid], crate::commands::derive_origin_accessors;
properties:
prop grid: CharGrid { get mut; set move; };
functions:

View file

@ -1,15 +1,10 @@
use crate::{
commands::{wrap_command, wrap_origin_accessors},
macros::wrap,
};
use crate::macros::wrap;
use servicepoint::{Cp437Grid, Cp437GridCommand, Origin};
use std::ptr::NonNull;
wrap_command!(Cp437Grid);
wrap_origin_accessors!(Cp437GridCommand);
wrap!(
Cp437GridCommand {
derives: crate::commands::derive_command[Cp437Grid], crate::commands::derive_origin_accessors;
properties:
prop grid: Cp437Grid { get mut; set move; };
functions:

View file

@ -1,11 +1,10 @@
use crate::{commands::wrap_command, macros::wrap};
use crate::macros::wrap;
use servicepoint::{Brightness, GlobalBrightnessCommand};
use std::ptr::NonNull;
wrap_command!(GlobalBrightness);
wrap!(
GlobalBrightnessCommand {
derives: crate::commands::derive_command[GlobalBrightness];
properties:
prop brightness: Brightness { get; set; };
functions:

View file

@ -14,8 +14,8 @@ pub use char_grid_command::*;
pub use cp437_grid_command::*;
pub use generic_command::*;
macro_rules! wrap_origin_accessors {
( $object_type:ident ) => {
macro_rules! derive_origin_accessors {
($object_type:ident) => {
::paste::paste! {
$crate::macros::wrap_methods!($object_type;
#[doc = " Reads the origin field of the [`" $object_type "`]."]
@ -70,21 +70,16 @@ macro_rules! derive_command_into_packet {
}
}
macro_rules! wrap_command {
($command:ident, $object_type:ident) => {
macro_rules! derive_command {
($object_type:ident, $command:ident) => {
$crate::macros::derive_clone!($object_type);
$crate::macros::derive_free!($object_type);
$crate::commands::derive_command_from!($command);
$crate::commands::derive_command_into_packet!($object_type);
};
($command:ident) => {
::paste::paste! {
$crate::commands::wrap_command!($command, [< $command Command >]);
}
};
}
pub(crate) use {
derive_command_from, derive_command_into_packet, wrap_command,
wrap_origin_accessors,
derive_command, derive_command_from, derive_command_into_packet,
derive_origin_accessors,
};