[][src]Trait flatdata::Struct

pub trait Struct<'a>: Clone {
    type Item: Ref;
    type ItemMut: RefMut;

    const SCHEMA: &'static str;
    const SIZE_IN_BYTES: usize;

    fn create(data: &'a [u8]) -> Self::Item;
fn create_mut(data: &'a mut [u8]) -> Self::ItemMut; }

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.

Associated Types

type Item: Ref

Item this factory will produce.

type ItemMut: RefMut

Item this factory will produce.

Loading content...

Associated Constants

const SCHEMA: &'static str

Schema of the type. Used only for debug and inspection purposes.

const SIZE_IN_BYTES: usize

Size of an object of this type in bytes.

Loading content...

Required methods

fn create(data: &'a [u8]) -> Self::Item

Creates a new item from a slice.

fn create_mut(data: &'a mut [u8]) -> Self::ItemMut

Creates a new item from a slice.

Loading content...

Implementors

Loading content...