[−][src]Trait buf_min::Buffer
Minimal Buffer trait
Associated Types
type Freeze
Into immutable type
Required methods
fn with_capacity(capacity: usize) -> Self where
Self: Sized,
Self: Sized,
Returns new Buffer with capacity
fn is_empty(&self) -> bool
Returns true if the Buffer has a length of 0.
fn extend_from_slice(&mut self, src: &[u8])
Appends given bytes to this Buffer.
Panics
Can panic if current length plus src length overflows usize
fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more bytes to be inserted
into the given Buffer.
Panics
Can panic if current capacity plus additional overflows usize
fn freeze(self) -> Self::Freeze
Converts self into a Freeze type
unsafe fn advance(&mut self, cnt: usize)
Advance the internal cursor of the Buffer
Safety
Can't advance more than capacity of the Buffer
Panics
Can panic if length plus cnt is bigger than capacity
unsafe fn buf_ptr(&mut self) -> *mut u8
Implementations on Foreign Types
impl Buffer for Vec<u8>[src]
type Freeze = Vec<u8>
fn with_capacity(capacity: usize) -> Self where
Self: Sized, [src]
Self: Sized,
fn is_empty(&self) -> bool[src]
fn extend_from_slice(&mut self, src: &[u8])[src]
fn reserve(&mut self, additional: usize)[src]
fn freeze(self) -> Self::Freeze[src]
unsafe fn advance(&mut self, cnt: usize)[src]
unsafe fn buf_ptr(&mut self) -> *mut u8[src]
impl Buffer for BytesMut[src]
type Freeze = Bytes
fn with_capacity(capacity: usize) -> Self where
Self: Sized, [src]
Self: Sized,