flatbuffers

Trait Push

Source
pub trait Push: Sized {
    type Output;

    // Required method
    unsafe fn push(&self, dst: &mut [u8], written_len: usize);

    // Provided methods
    fn size() -> usize { ... }
    fn alignment() -> PushAlignment { ... }
}
Expand description

Trait to abstract over functionality needed to write values (either owned or referenced). Used in FlatBufferBuilder and implemented for generated types.

Required Associated Types§

Required Methods§

Source

unsafe fn push(&self, dst: &mut [u8], written_len: usize)

§Safety

dst is aligned to Self::alignment and has length greater than or equal to Self::size

Provided Methods§

Source

fn size() -> usize

Source

fn alignment() -> PushAlignment

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 Push for bool

Source§

type Output = bool

Source§

unsafe fn push(&self, dst: &mut [u8], _written_len: usize)

Source§

impl Push for f32

Source§

type Output = f32

Source§

unsafe fn push(&self, dst: &mut [u8], _written_len: usize)

Source§

impl Push for f64

Source§

type Output = f64

Source§

unsafe fn push(&self, dst: &mut [u8], _written_len: usize)

Source§

impl Push for i8

Source§

type Output = i8

Source§

unsafe fn push(&self, dst: &mut [u8], _written_len: usize)

Source§

impl Push for i16

Source§

type Output = i16

Source§

unsafe fn push(&self, dst: &mut [u8], _written_len: usize)

Source§

impl Push for i32

Source§

type Output = i32

Source§

unsafe fn push(&self, dst: &mut [u8], _written_len: usize)

Source§

impl Push for i64

Source§

type Output = i64

Source§

unsafe fn push(&self, dst: &mut [u8], _written_len: usize)

Source§

impl Push for u8

Source§

type Output = u8

Source§

unsafe fn push(&self, dst: &mut [u8], _written_len: usize)

Source§

impl Push for u16

Source§

type Output = u16

Source§

unsafe fn push(&self, dst: &mut [u8], _written_len: usize)

Source§

impl Push for u32

Source§

type Output = u32

Source§

unsafe fn push(&self, dst: &mut [u8], _written_len: usize)

Source§

impl Push for u64

Source§

type Output = u64

Source§

unsafe fn push(&self, dst: &mut [u8], _written_len: usize)

Source§

impl<'a, T: Push> Push for &'a T

Source§

type Output = <T as Push>::Output

Source§

unsafe fn push(&self, dst: &mut [u8], written_len: usize)

Source§

fn size() -> usize

Source§

fn alignment() -> PushAlignment

Implementors§