pub trait DataBuf: AsMut<[Self::Inner]> + AsRef<[Self::Inner]> {
    type Inner: Pod;
    fn extend(&mut self, len: usize) -> Result<(), ()>;

    fn round_to_words(bytes: usize) -> usize { ... }
}
Expand description

Trait used to represent a data buffer, typically you’ll passs a [usize; N] array.

Can also provide a Vec<T> (if the alloc feature is enabled) which will grow as-needed

Associated Types

Inner type of the buffer

Required methods

Extend the buffer (fallible)

Provided methods

Convert a byte count to a word count (rounding up)

Implementations on Foreign Types

Array-specific impl

Vector backed structures, can be used to auto-grow the allocation

let mut buf = ::stack_dst::FifoA::<str, Vec<u8>>::new();
buf.push_back_str("Hello world!");
buf.push_back_str("This is a very long string");
buf.push_back_str("The buffer should keep growing as it needs to");
for line in buf.iter() {
  println!("{}", line);
}

Implementors