Trait flatbuffers::Follow

source ·
pub trait Follow<'buf> {
    type Inner;

    unsafe fn follow(buf: &'buf [u8], loc: usize) -> Self::Inner;
}
Expand description

Follow is a trait that allows us to access FlatBuffers in a declarative, type safe, and fast way. They compile down to almost no code (after optimizations). Conceptually, Follow lifts the offset-based access patterns of FlatBuffers data into the type system. This trait is used pervasively at read time, to access tables, vtables, vectors, strings, and all other data. At this time, Follow is not utilized much on the write path.

Writing a new Follow implementation primarily involves deciding whether you want to return data (of the type Self::Inner) or do you want to continue traversing the FlatBuffer.

Required Associated Types§

Required Methods§

Safety

buf[loc..] must contain a valid value of Self and anything it transitively refers to by offset must also be valid

Implementations on Foreign Types§

Implementors§

Implement Follow for all possible Vectors that have Follow-able elements.

Implement Follow for all possible Arrays that have Follow-able elements.