Trait ssh_format::SerBacker

source ·
pub trait SerBacker {
    // Required methods
    fn new() -> Self;
    fn len(&self) -> usize;
    fn get_first_4byte_slice(&mut self) -> &mut [u8; 4];
    fn extend_from_slice(&mut self, other: &[u8]);
    fn push(&mut self, byte: u8);
    fn reset(&mut self);
    fn reserve(&mut self, additional: usize);
}
Expand description

A trait for which can be used to store serialized output.

Required Methods§

source

fn new() -> Self

Return a new backer which len() == 4.

source

fn len(&self) -> usize

source

fn get_first_4byte_slice(&mut self) -> &mut [u8; 4]

source

fn extend_from_slice(&mut self, other: &[u8])

source

fn push(&mut self, byte: u8)

source

fn reset(&mut self)

Reset to the initial state where len() == 4

source

fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more bytes to be inserted.

More than additional bytes may be reserved in order to avoid frequent reallocations. A call to reserve may result in an allocation.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl SerBacker for Vec<u8>

source§

fn new() -> Self

source§

fn len(&self) -> usize

source§

fn get_first_4byte_slice(&mut self) -> &mut [u8; 4]

source§

fn extend_from_slice(&mut self, other: &[u8])

source§

fn push(&mut self, byte: u8)

source§

fn reset(&mut self)

source§

fn reserve(&mut self, additional: usize)

Implementors§