Skip to main content

Append

Trait Append 

Source
pub trait Append {
    // Required methods
    fn append_bytes(&mut self, bytes: &[u8]) -> Result<(), BufferTooSmall>;
    fn append_bytes_zeroed(
        &mut self,
        len: usize,
    ) -> Result<&mut [u8], BufferTooSmall>;
    fn can_append(&self, bytes: usize) -> bool;

    // Provided methods
    fn append_value<T>(&mut self, value: &T) -> Result<(), BufferTooSmall>
       where T: IntoBytes + Immutable + ?Sized { ... }
    fn append_byte(&mut self, byte: u8) -> Result<(), BufferTooSmall> { ... }
    fn append_value_zeroed<T>(
        &mut self,
    ) -> Result<Ref<&mut [u8], T>, BufferTooSmall>
       where T: FromBytes + KnownLayout + Immutable + Unaligned { ... }
    fn append_array_zeroed<T>(
        &mut self,
        num_elems: usize,
    ) -> Result<Ref<&mut [u8], [T]>, BufferTooSmall>
       where T: FromBytes + Immutable + Unaligned { ... }
}

Required Methods§

Source

fn append_bytes(&mut self, bytes: &[u8]) -> Result<(), BufferTooSmall>

Source

fn append_bytes_zeroed( &mut self, len: usize, ) -> Result<&mut [u8], BufferTooSmall>

Source

fn can_append(&self, bytes: usize) -> bool

Provided Methods§

Source

fn append_value<T>(&mut self, value: &T) -> Result<(), BufferTooSmall>
where T: IntoBytes + Immutable + ?Sized,

Source

fn append_byte(&mut self, byte: u8) -> Result<(), BufferTooSmall>

Source

fn append_value_zeroed<T>( &mut self, ) -> Result<Ref<&mut [u8], T>, BufferTooSmall>

Source

fn append_array_zeroed<T>( &mut self, num_elems: usize, ) -> Result<Ref<&mut [u8], [T]>, BufferTooSmall>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Append for Vec<u8>

Source§

fn append_bytes(&mut self, bytes: &[u8]) -> Result<(), BufferTooSmall>

Source§

fn append_bytes_zeroed( &mut self, len: usize, ) -> Result<&mut [u8], BufferTooSmall>

Source§

fn can_append(&self, _bytes: usize) -> bool

Implementors§