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;
}

View file

@ -29,22 +29,16 @@
pub mod commands;
/// Functions related to [servicepoint::Bitmap], [servicepoint::CharGrid] and friends.
pub mod containers;
mod macros;
pub(crate) mod macros;
pub(crate) mod mem;
/// Functions related to [Packet].
/// Functions related to [servicepoint::Packet].
pub mod packet;
/// Functions related to [UdpSocket].
/// Functions related to [servicepoint::UdpSocketExt].
pub mod udp;
/// Actual hardware limit is around 28-29ms/frame. Rounded up for less dropped packets.
pub const SP_FRAME_PACING_MS: u128 = 30;
/// This is a type only used by cbindgen to have a type for pointers.
pub struct UdpSocket;
/// This is a type only used by cbindgen to have a type for pointers.
pub struct DisplayBitVec;
#[cfg(feature = "env_logger")]
mod feature_env_logger {
use crate::macros::wrap_functions;

View file

@ -50,7 +50,7 @@ macro_rules! wrap_methods {
paste::paste! {
$crate::macros::wrap_functions!($prefix;
$(
#[doc = concat!(" Calls [`servicepoint::", stringify!($object_type),
#[doc = concat!(" Calls method [`servicepoint::", stringify!($object_type),
"::", stringify!($function), "`].")]
#[doc = ""]
$(#[$meta])*

View file

@ -129,3 +129,11 @@ wrap_functions!(sp_udp;
}
);
mod _hidden {
/// This is a type only used by cbindgen to have a type for pointers.
///
/// See [servicepoint::UdpSocketExt].
#[allow(unused)]
pub struct UdpSocket;
}