[][src]Trait driver_async::bytes::Storage

pub trait Storage<T: Copy + Default>: AsRef<[T]> + AsMut<[T]> + Unpin {
    fn with_size(size: usize) -> Self
    where
        Self: Sized
;
fn max_len() -> usize; fn from_slice(buf: &[T]) -> Self
    where
        Self: Sized
, { ... }
fn space_left(&self) -> usize { ... }
fn len(&self) -> usize { ... } }

Objects that store and own Ts (Box<[T]>, Vec<T>, StaticBuf<[T; 32]>, etc). This allows for generic byte storage types for byte buffers. This also enable generic storage for any T type but the Copy + Default requirement might be too restricting for all cases.

Required methods

fn with_size(size: usize) -> Self where
    Self: Sized

fn max_len() -> usize

Loading content...

Provided methods

fn from_slice(buf: &[T]) -> Self where
    Self: Sized

fn space_left(&self) -> usize

fn len(&self) -> usize

Loading content...

Implementations on Foreign Types

impl<T: Copy + Unpin + Default> Storage<T> for Vec<T>[src]

impl<T: Copy + Unpin + Default> Storage<T> for Box<[T]>[src]

Loading content...

Implementors

impl<T: Copy + Unpin + Default, ArrayBuf: AsRef<[T]> + AsMut<[T]> + Default + Copy + Unpin> Storage<T> for StaticBuf<T, ArrayBuf>[src]

Loading content...