Struct dungeon_cell::Size
source · pub struct Size<const N: usize> { /* private fields */ }
Expand description
Size in bytes.
This is the type to use where ValidSize
is required.
Size
also has an associated Buffer
with a length
equal to the const generic. The buffer is of type [MaybeUninit<u8>; N]
.
Examples
use std::mem::size_of;
use dungeon_cell::{Size, valid_generic_markers::ValidSize};
struct Test<S: ValidSize> {
buffer: S::Buffer,
}
assert_eq!(size_of::<Test::<Size<6>>>(), 6);
assert_eq!(size_of::<Test::<Size<14>>>(), 14);
Trait Implementations§
source§impl<const N: usize> ValidSize for Size<N>
impl<const N: usize> ValidSize for Size<N>
§type Buffer = [MaybeUninit<u8>; N]
type Buffer = [MaybeUninit<u8>; N]
Type of the buffer with a size equal to
Self::VALUE
.
This type is always [MaybeUninit<u8>; Self::VALUE
].source§const UNINIT_BUFFER: Self::Buffer = _
const UNINIT_BUFFER: Self::Buffer = _
An uninitialized instance of the associated
Self::Buffer
.source§const VALUE: usize = N
const VALUE: usize = N
Size of the associated
Self::Buffer
.