fix docs, misc tweaks

This commit is contained in:
Vinzenz Schroeter 2025-06-19 18:32:07 +02:00
parent b79a2534fc
commit 18f0be072a
7 changed files with 56 additions and 45 deletions

View file

@ -1,7 +1,6 @@
use crate::macros::wrap_functions;
use crate::{
containers::ByteSlice,
macros::{wrap_clone, wrap_free, wrap_methods},
macros::{wrap_clone, wrap_free, wrap_functions, wrap_methods},
mem::{heap_move_nonnull, heap_move_ok, heap_move_some, heap_remove},
};
use servicepoint::{
@ -121,11 +120,13 @@ wrap_methods!(
///
/// The returned memory is valid for the lifetime of the grid.
mut fn data_ref_mut() -> ByteSlice {
return(br_slice) { unsafe {
return(br_slice) {
//noinspection RsAssertEqual
const _: () = assert!(size_of::<Brightness>() == 1);
ByteSlice::from_slice(transmute::<&mut [Brightness], &mut [u8]>(br_slice))
}};
unsafe {
ByteSlice::from_slice(transmute::<&mut [Brightness], &mut [u8]>(br_slice))
}
};
};
);

View file

@ -26,7 +26,8 @@ pub struct ByteSlice {
}
impl ByteSlice {
pub(crate) const INVALID: ByteSlice = ByteSlice {
/// Represents an invalid [ByteSlice] instance.
pub const INVALID: ByteSlice = ByteSlice {
start: std::ptr::null_mut(),
length: 0,
};

View file

@ -11,3 +11,8 @@ pub use brightness_grid::*;
pub use byte_slice::*;
pub use char_grid::*;
pub use cp437_grid::*;
mod _hidden {
/// This is a type only used by cbindgen to have a type for pointers.
pub struct DisplayBitVec;
}