clone and free with :: syntax

This commit is contained in:
Vinzenz Schroeter 2025-06-17 22:11:10 +02:00
parent 9756ef39b7
commit 514c0304b8
15 changed files with 59 additions and 59 deletions

View file

@ -80,11 +80,11 @@ pub unsafe extern "C" fn sp_bitmap_from_bitvec(
heap_move_ok(Bitmap::from_bitvec(width, bitvec))
}
wrap_clone!(Bitmap, sp_bitmap);
wrap_free!(Bitmap, sp_bitmap);
wrap_clone!(sp_bitmap::Bitmap);
wrap_free!(sp_bitmap::Bitmap);
wrap_method!(
sp_bitmap :: Bitmap;
sp_bitmap::Bitmap;
/// Gets the current value at the specified position.
///
/// # Arguments
@ -98,7 +98,7 @@ wrap_method!(
);
wrap_method!(
sp_bitmap :: Bitmap;
sp_bitmap::Bitmap;
/// Sets the value of the specified position.
///
/// # Arguments
@ -113,7 +113,7 @@ wrap_method!(
);
wrap_method!(
sp_bitmap :: Bitmap;
sp_bitmap::Bitmap;
/// Sets the state of all pixels in the [Bitmap].
///
/// # Arguments
@ -123,19 +123,19 @@ wrap_method!(
);
wrap_method!(
sp_bitmap :: Bitmap;
sp_bitmap::Bitmap;
/// Gets the width in pixels.
ref fn width() -> usize;
);
wrap_method!(
sp_bitmap :: Bitmap;
sp_bitmap::Bitmap;
/// Gets the height in pixels.
ref fn height() -> usize;
);
wrap_method!(
sp_bitmap :: Bitmap;
sp_bitmap::Bitmap;
/// Gets an unsafe reference to the data of the [Bitmap] instance.
///
/// The returned memory is valid for the lifetime of the bitmap.

View file

@ -35,11 +35,11 @@ pub unsafe extern "C" fn sp_bitvec_load(
heap_move_nonnull(DisplayBitVec::from_slice(data))
}
wrap_clone!(DisplayBitVec, sp_bitvec);
wrap_free!(DisplayBitVec, sp_bitvec);
wrap_clone!(sp_bitvec::DisplayBitVec);
wrap_free!(sp_bitvec::DisplayBitVec);
wrap_method!(
sp_bitvec :: DisplayBitVec;
sp_bitvec::DisplayBitVec;
/// Gets the value of a bit.
///
/// # Arguments
@ -57,7 +57,7 @@ wrap_method!(
);
wrap_method!(
sp_bitvec :: DisplayBitVec;
sp_bitvec::DisplayBitVec;
/// Sets the value of a bit.
///
/// # Arguments
@ -72,7 +72,7 @@ wrap_method!(
);
wrap_method!(
sp_bitvec :: DisplayBitVec;
sp_bitvec::DisplayBitVec;
/// Sets the value of all bits.
///
/// # Arguments
@ -82,19 +82,19 @@ wrap_method!(
);
wrap_method!(
sp_bitvec :: DisplayBitVec;
sp_bitvec::DisplayBitVec;
/// Gets the length in bits.
ref fn len() -> usize;
);
wrap_method!(
sp_bitvec :: DisplayBitVec;
sp_bitvec::DisplayBitVec;
/// Returns true if length is 0.
ref fn is_empty() -> bool;
);
wrap_method!(
sp_bitvec :: DisplayBitVec;
sp_bitvec::DisplayBitVec;
/// Gets an unsafe reference to the data of the [DisplayBitVec] instance.
///
/// The returned memory is valid for the lifetime of the bitvec.

View file

@ -52,11 +52,11 @@ pub unsafe extern "C" fn sp_brightness_grid_load(
)
}
wrap_clone!(BrightnessGrid, sp_brightness_grid);
wrap_free!(BrightnessGrid, sp_brightness_grid);
wrap_clone!(sp_brightness_grid::BrightnessGrid);
wrap_free!(sp_brightness_grid::BrightnessGrid);
wrap_method!(
sp_brightness_grid :: BrightnessGrid;
sp_brightness_grid::BrightnessGrid;
/// Gets the current value at the specified position.
///
/// # Arguments
@ -71,7 +71,7 @@ wrap_method!(
);
wrap_method!(
sp_brightness_grid :: BrightnessGrid;
sp_brightness_grid::BrightnessGrid;
/// Sets the value of the specified position.
///
/// # Arguments
@ -88,7 +88,7 @@ wrap_method!(
);
wrap_method!(
sp_brightness_grid :: BrightnessGrid;
sp_brightness_grid::BrightnessGrid;
/// Sets the value of all cells.
///
/// # Arguments
@ -98,19 +98,19 @@ wrap_method!(
);
wrap_method!(
sp_brightness_grid :: BrightnessGrid;
sp_brightness_grid::BrightnessGrid;
/// Gets the width of the grid.
ref fn width() -> usize;
);
wrap_method!(
sp_brightness_grid :: BrightnessGrid;
sp_brightness_grid::BrightnessGrid;
/// Gets the height of the grid.
ref fn height() -> usize;
);
wrap_method!(
sp_brightness_grid :: BrightnessGrid;
sp_brightness_grid::BrightnessGrid;
/// Gets an unsafe reference to the data of the instance.
///
/// The returned memory is valid for the lifetime of the grid.

View file

@ -39,11 +39,11 @@ pub unsafe extern "C" fn sp_char_grid_load(
heap_move_ok(CharGrid::load_utf8(width, height, data.to_vec()))
}
wrap_clone!(CharGrid, sp_char_grid);
wrap_free!(CharGrid, sp_char_grid);
wrap_clone!(sp_char_grid::CharGrid);
wrap_free!(sp_char_grid::CharGrid);
wrap_method!(
sp_char_grid :: CharGrid;
sp_char_grid::CharGrid;
/// Returns the current value at the specified position.
///
/// # Arguments
@ -58,7 +58,7 @@ wrap_method!(
);
wrap_method!(
sp_char_grid :: CharGrid;
sp_char_grid::CharGrid;
/// Sets the value of the specified position in the grid.
///
/// # Arguments
@ -77,7 +77,7 @@ wrap_method!(
);
wrap_method!(
sp_char_grid :: CharGrid;
sp_char_grid::CharGrid;
/// Sets the value of all cells in the grid.
///
/// # Arguments
@ -89,13 +89,13 @@ wrap_method!(
);
wrap_method!(
sp_char_grid :: CharGrid;
sp_char_grid::CharGrid;
/// Gets the width of the grid.
ref fn width() -> usize;
);
wrap_method!(
sp_char_grid :: CharGrid;
sp_char_grid::CharGrid;
/// Gets the height of the grid.
ref fn height() -> usize;
);

View file

@ -30,11 +30,11 @@ pub unsafe extern "C" fn sp_cp437_grid_load(
heap_move_some(Cp437Grid::load(width, height, data))
}
wrap_clone!(Cp437Grid, sp_cp437_grid);
wrap_free!(Cp437Grid, sp_cp437_grid);
wrap_clone!(sp_cp437_grid::Cp437Grid);
wrap_free!(sp_cp437_grid::Cp437Grid);
wrap_method!(
sp_cp437 :: Cp437Grid;
sp_cp437::Cp437Grid;
/// Gets the current value at the specified position.
///
/// # Arguments
@ -48,7 +48,7 @@ wrap_method!(
);
wrap_method!(
sp_cp437 :: Cp437Grid;
sp_cp437::Cp437Grid;
/// Sets the value at the specified position.
///
/// # Arguments
@ -65,7 +65,7 @@ wrap_method!(
);
wrap_method!(
sp_cp437 :: Cp437Grid;
sp_cp437::Cp437Grid;
/// Sets the value of all cells in the grid.
///
/// # Arguments
@ -76,19 +76,19 @@ wrap_method!(
);
wrap_method!(
sp_cp437 :: Cp437Grid;
sp_cp437::Cp437Grid;
/// Gets the width of the grid.
ref fn width() -> usize;
);
wrap_method!(
sp_cp437 :: Cp437Grid;
sp_cp437::Cp437Grid;
/// Gets the height of the grid.
ref fn height() -> usize;
);
wrap_method!(
sp_cp437 :: Cp437Grid;
sp_cp437::Cp437Grid;
/// Gets an unsafe reference to the data of the grid.
///
/// The returned memory is valid for the lifetime of the instance.