Trait den::ExtendVec

source ·
pub trait ExtendVec: Debug {
    // Required methods
    fn extend(&self, vec: &mut Vec<u8>);
    fn replace(&self, vec: &mut Vec<u8>, position: usize);
    fn equals(&self, bytes: &[u8]) -> bool;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A trait to fill extend a Vec with more data.

This is by default implemented by all types which can cohere to a byte slice &[u8].

Required Methods§

source

fn extend(&self, vec: &mut Vec<u8>)

Extend vec with our data. This must extend with ExtendVec::len bytes.

source

fn replace(&self, vec: &mut Vec<u8>, position: usize)

Copy the bytes of this struct to position in vec, overriding any data there. This must replace ExtendVec::len bytes.

source

fn equals(&self, bytes: &[u8]) -> bool

If our data equals bytes.

source

fn len(&self) -> usize

The length of the data of this struct.

Provided Methods§

source

fn is_empty(&self) -> bool

If no data is available.

Implementors§

source§

impl<T: AsRef<[u8]> + Debug> ExtendVec for T