Trait flatdata::Struct

source ·
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§

source

const SIZE_IN_BYTES: usize

Size of an object of this type in bytes.

source

const IS_OVERLAPPING_WITH_NEXT: bool

Whether this structs requires data of the next instance

Required Methods§

source

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

Implementors§