flatbuffers

Trait Follow

Source
pub trait Follow<'buf> {
    type Inner;

    // Required method
    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§

Source

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

§Safety

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a> Follow<'a> for &'a str

Source§

type Inner = &'a str

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Source§

impl<'a> Follow<'a> for &'a [u8]

Source§

type Inner = &'a [u8]

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Source§

impl<'a> Follow<'a> for bool

Source§

type Inner = bool

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Source§

impl<'a> Follow<'a> for f32

Source§

type Inner = f32

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Source§

impl<'a> Follow<'a> for f64

Source§

type Inner = f64

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Source§

impl<'a> Follow<'a> for i8

Source§

type Inner = i8

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Source§

impl<'a> Follow<'a> for i16

Source§

type Inner = i16

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Source§

impl<'a> Follow<'a> for i32

Source§

type Inner = i32

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Source§

impl<'a> Follow<'a> for i64

Source§

type Inner = i64

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Source§

impl<'a> Follow<'a> for u8

Source§

type Inner = u8

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Source§

impl<'a> Follow<'a> for u16

Source§

type Inner = u16

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Source§

impl<'a> Follow<'a> for u32

Source§

type Inner = u32

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Source§

impl<'a> Follow<'a> for u64

Source§

type Inner = u64

Source§

unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner

Implementors§

Source§

impl<'a> Follow<'a> for FileIdentifier

Source§

type Inner = &'a [u8]

Source§

impl<'a> Follow<'a> for Table<'a>

Source§

type Inner = Table<'a>

Source§

impl<'a, T: Follow<'a> + 'a> Follow<'a> for SkipFileIdentifier<T>

Source§

type Inner = <T as Follow<'a>>::Inner

Source§

impl<'a, T: Follow<'a> + 'a> Follow<'a> for SkipRootOffset<T>

Source§

type Inner = <T as Follow<'a>>::Inner

Source§

impl<'a, T: Follow<'a> + 'a> Follow<'a> for SkipSizePrefix<T>

Source§

type Inner = <T as Follow<'a>>::Inner

Source§

impl<'a, T: Follow<'a> + 'a> Follow<'a> for Vector<'a, T>

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

Source§

type Inner = Vector<'a, T>

Source§

impl<'a, T: Follow<'a> + 'a, const N: usize> Follow<'a> for Array<'a, T, N>

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

Source§

type Inner = Array<'a, T, N>

Source§

impl<'a, T: Follow<'a>> Follow<'a> for BackwardsSOffset<T>

Source§

type Inner = <T as Follow<'a>>::Inner

Source§

impl<'a, T: Follow<'a>> Follow<'a> for FollowStart<T>

Source§

type Inner = <T as Follow<'a>>::Inner

Source§

impl<'a, T: Follow<'a>> Follow<'a> for ForwardsUOffset<T>

Source§

type Inner = <T as Follow<'a>>::Inner

Source§

impl<'a, T: Follow<'a>> Follow<'a> for ForwardsVOffset<T>

Source§

type Inner = <T as Follow<'a>>::Inner