pub trait Struct: Debug {
const SIZE_IN_BYTES: usize;
const IS_OVERLAPPING_WITH_NEXT: bool;
// Required method
unsafe fn create_unchecked() -> Self;
}
Expand description
A factory trait used to bind lifetime to Ref implementations.
Vector/ArrayView-like classes cannot be directly implemented over the structs since that binds lifetime too early. Instead this generic factory and Higher-Rank-Trait-Bounds are used to emulate higher-kinded-generics.
Required Associated Constants§
sourceconst SIZE_IN_BYTES: usize
const SIZE_IN_BYTES: usize
Size of an object of this type in bytes.
sourceconst IS_OVERLAPPING_WITH_NEXT: bool
const IS_OVERLAPPING_WITH_NEXT: bool
Whether this structs requires data of the next instance
Required Methods§
sourceunsafe fn create_unchecked() -> Self
unsafe fn create_unchecked() -> Self
Create a new struct
Safety
If the struct is not self-contained (NoOverlap), and there is no directly subsequent structure in memory, then the resulting instance’s data must not be accessed