Trait SlabItem
pub trait SlabItem: Sized + Any {
const SLAB_SIZE: usize;
// Required methods
fn read_slab(index: usize, slab: &[u32]) -> Self;
fn write_slab(&self, index: usize, slab: &mut [u32]) -> usize;
}
Expand description
Determines the “size” of a type when stored in a slab of &[u32]
,
and how to read/write it from/to the slab.
SlabItem
can be automatically derived for struct and tuple types,
so long as those types’ fields implement SlabItem
.
Required Associated Constants§
Required Methods§
fn write_slab(&self, index: usize, slab: &mut [u32]) -> usize
fn write_slab(&self, index: usize, slab: &mut [u32]) -> usize
Write the type into the slab at starting index
and return
the new index.
If the type cannot be written, the returned index will be equal
to index
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.