Buffer

Trait Buffer 

Source
pub trait Buffer<'data> {
    type Intermediate: ToBufferRef<'data>;

    // Required method
    fn to_to_buffer_ref(self) -> Self::Intermediate;

    // Provided method
    fn cap_at(self, len: usize) -> CapAt<'data, Self>
       where Self: Sized { ... }
}
Expand description

Trait for types that can act as buffer for bytes.

It should be accepted as trait bound for functions that accept buffers, and should immediately be converted to BufferRef using the with_buffer function.

Required Associated Types§

Source

type Intermediate: ToBufferRef<'data>

Intermediate result of converting the T: Buffer into a BufferRef.

Required Methods§

Source

fn to_to_buffer_ref(self) -> Self::Intermediate

Converts the T: Buffer into the intermediate step to BufferRef.

Provided Methods§

Source

fn cap_at(self, len: usize) -> CapAt<'data, Self>
where Self: Sized,

Caps the buffer at the specified byte index.

This means that no more than len bytes will be written to the buffer.

Implementations on Foreign Types§

Source§

impl<'d> Buffer<'d> for &'d mut &'d mut [u8]

Source§

impl<'d> Buffer<'d> for &'d mut [u8]

Source§

impl<'d, A: Array<Item = u8>> Buffer<'d> for &'d mut ArrayVec<A>

Source§

impl<'data> Buffer<'data> for &'data mut Vec<u8>

Implementors§

Source§

impl<'data, T: Buffer<'data>> Buffer<'data> for CapAt<'data, T>

Source§

type Intermediate = CapAtBuffer<'data, <T as Buffer<'data>>::Intermediate>

Source§

impl<'r, 'd, 's> Buffer<'d> for &'r mut BufferRef<'d, 's>