wip generic wrap

This commit is contained in:
Vinzenz Schroeter 2025-06-26 20:42:31 +02:00
parent 82696b2d1a
commit 5beea6151a
15 changed files with 83 additions and 59 deletions

View file

@ -1,13 +1,13 @@
use crate::{
commands::{wrap_command, wrap_origin_accessors},
macros::{wrap_fields, wrap_functions},
macros::{wrap, wrap_functions},
};
use servicepoint::{Bitmap, BitmapCommand, CompressionCode, Origin};
use std::ptr::NonNull;
wrap_command!(Bitmap);
wrap_fields!(BitmapCommand;
wrap!(BitmapCommand;
prop bitmap: Bitmap { get mut; set move; };
prop compression: CompressionCode { get; set; };
);

View file

@ -1,6 +1,6 @@
use crate::{
commands::wrap_command,
macros::{wrap_fields, wrap_functions},
macros::{wrap, wrap_functions},
};
use servicepoint::{
BinaryOperation, BitVecCommand, CompressionCode, DisplayBitVec, Offset,
@ -9,7 +9,7 @@ use std::ptr::NonNull;
wrap_command!(BitVec);
wrap_fields!(BitVecCommand;
wrap!(BitVecCommand;
prop bitvec: DisplayBitVec { get mut; set move; };
prop offset: Offset { get; set; };
prop operation: BinaryOperation { get; set; };

View file

@ -1,13 +1,13 @@
use crate::{
commands::{wrap_command, wrap_origin_accessors},
macros::{wrap_fields, wrap_functions},
macros::{wrap, wrap_functions},
};
use servicepoint::{BrightnessGrid, BrightnessGridCommand, Origin};
use std::ptr::NonNull;
wrap_command!(BrightnessGrid);
wrap_fields!(BrightnessGridCommand;
wrap!(BrightnessGridCommand;
prop grid: BrightnessGrid { get mut; set move; };
);

View file

@ -1,13 +1,13 @@
use crate::{
commands::{wrap_command, wrap_origin_accessors},
macros::{wrap_fields, wrap_functions},
macros::{wrap, wrap_functions},
};
use servicepoint::{CharGrid, CharGridCommand, Origin};
use std::ptr::NonNull;
wrap_command!(CharGrid);
wrap_fields!(CharGridCommand;
wrap!(CharGridCommand;
prop grid: CharGrid { get mut; set move; };
);

View file

@ -1,13 +1,13 @@
use crate::{
commands::{wrap_command, wrap_origin_accessors},
macros::{wrap_fields, wrap_functions},
macros::{wrap, wrap_functions},
};
use servicepoint::{Cp437Grid, Cp437GridCommand, Origin};
use std::ptr::NonNull;
wrap_command!(Cp437Grid);
wrap_fields!(Cp437GridCommand;
wrap!(Cp437GridCommand;
prop grid: Cp437Grid { get mut; set move; };
);

View file

@ -1,5 +1,5 @@
use crate::{
macros::{derive_clone, derive_free, wrap_functions, wrap_methods},
macros::{derive_clone, derive_free, wrap, wrap_functions},
mem::{
heap_clone, heap_drop, heap_move, heap_move_nonnull, heap_move_ok,
heap_remove,
@ -250,12 +250,12 @@ wrap_functions!(associate GenericCommand;
};
);
wrap_methods! { GenericCommand;
wrap! { GenericCommand;
/// Tries to turn a [GenericCommand] into a [Packet].
/// The [GenericCommand] gets consumed.
///
/// Returns tag [CommandTag::Invalid] in case of an error.
fn try_into_packet(move command) -> val *mut Packet {
method try_into_packet(move command) -> val *mut Packet {
match command.tag {
CommandTag::Invalid => null_mut(),
CommandTag::Bitmap => {

View file

@ -1,6 +1,6 @@
use crate::{
commands::wrap_command,
macros::{wrap_fields, wrap_functions},
macros::{wrap, wrap_functions},
};
use servicepoint::{Brightness, GlobalBrightnessCommand};
use std::ptr::NonNull;
@ -16,6 +16,6 @@ wrap_functions!(associate GlobalBrightnessCommand;
wrap_command!(GlobalBrightness);
wrap_fields!(GlobalBrightnessCommand;
wrap!(GlobalBrightnessCommand;
prop brightness: Brightness { get; set; };
);