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,17 +1,13 @@
use crate::{
containers::{wrap_grid, ByteSlice},
macros::wrap,
};
use crate::{containers::ByteSlice, macros::wrap};
use servicepoint::{
Bitmap, BitmapCommand, CompressionCode, DataRef, DisplayBitVec, Grid,
Origin, Packet,
};
use std::ptr::NonNull;
wrap_grid!(Bitmap, bool);
wrap! {
Bitmap {
derives: crate::containers::derive_container, crate::containers::derive_grid[bool];
functions:
/// Creates a new [Bitmap] with the specified dimensions.
///

View file

@ -1,16 +1,12 @@
use crate::{
containers::{wrap_container, ByteSlice},
macros::wrap,
};
use crate::{containers::ByteSlice, macros::wrap};
use servicepoint::{
BinaryOperation, BitVecCommand, CompressionCode, DisplayBitVec, Packet,
};
use std::ptr::NonNull;
wrap_container!(DisplayBitVec);
wrap! {
DisplayBitVec {
derives: crate::containers::derive_container;
functions:
/// Creates a new [DisplayBitVec] instance.
///

View file

@ -1,17 +1,13 @@
use crate::{
containers::{wrap_grid, ByteSlice},
macros::wrap,
};
use crate::{containers::ByteSlice, macros::wrap};
use servicepoint::{
Brightness, BrightnessGrid, BrightnessGridCommand, ByteGrid, DataRef, Grid,
Origin, Packet,
};
use std::{mem::transmute, ptr::NonNull};
wrap_grid!(BrightnessGrid, Brightness);
wrap! {
BrightnessGrid {
derives: crate::containers::derive_container, crate::containers::derive_grid[Brightness];
functions:
/// Creates a new [BrightnessGrid] with the specified dimensions.
///

View file

@ -1,15 +1,10 @@
use crate::{
containers::{derive_get_width_height, wrap_container, ByteSlice},
macros::wrap,
};
use crate::{containers::ByteSlice, macros::wrap};
use servicepoint::{CharGrid, CharGridCommand, Grid, Origin, Packet};
use std::ptr::NonNull;
wrap_container!(CharGrid);
derive_get_width_height!(CharGrid);
wrap! {
CharGrid {
derives: crate::containers::derive_container, crate::containers::derive_get_width_height;
functions:
/// Creates a new [CharGrid] with the specified dimensions.
///

View file

@ -1,16 +1,12 @@
use crate::{
containers::{wrap_grid, ByteSlice},
macros::wrap,
};
use crate::{containers::ByteSlice, macros::wrap};
use servicepoint::{
Cp437Grid, Cp437GridCommand, DataRef, Grid, Origin, Packet,
};
use std::ptr::NonNull;
wrap_grid!(Cp437Grid, u8);
wrap! {
Cp437Grid {
derives: crate::containers::derive_container, crate::containers::derive_grid[u8];
functions:
/// Creates a new [Cp437Grid] with the specified dimensions.
///

View file

@ -12,7 +12,7 @@ pub use byte_slice::*;
pub use char_grid::*;
pub use cp437_grid::*;
macro_rules! wrap_container {
macro_rules! derive_container {
($object_type:ident) => {
$crate::macros::derive_clone!($object_type);
$crate::macros::derive_free!($object_type);
@ -31,9 +31,8 @@ macro_rules! derive_get_width_height {
};
}
macro_rules! wrap_grid {
macro_rules! derive_grid {
($object_type:ident, $value_type:ident) => {
$crate::containers::wrap_container!($object_type);
$crate::containers::derive_get_width_height!($object_type);
$crate::macros::wrap_methods! {$object_type;
/// Gets the current value at the specified position.
@ -69,7 +68,7 @@ macro_rules! wrap_grid {
};
}
pub(crate) use {derive_get_width_height, wrap_container, wrap_grid};
pub(crate) use {derive_container, derive_get_width_height, derive_grid};
mod _hidden {
/// This is a type only used by cbindgen to have a type for pointers.