pub trait Buffer {
type Freeze;
fn with_capacity(capacity: usize) -> Self
where
Self: Sized;
fn is_empty(&self) -> bool;
fn len(&self) -> usize;
unsafe fn extend_from_slice(&mut self, src: &[u8]);
fn reserve(&mut self, additional: usize);
fn freeze(self) -> Self::Freeze;
unsafe fn advance(&mut self, cnt: usize);
unsafe fn buf_ptr(&mut self) -> *mut u8;
fn extend(&mut self, src: &str) { ... }
}
Expand description
Minimal Buffer trait with utf-8 safety
Required Associated Types
Required Methods
sourcefn with_capacity(capacity: usize) -> Selfwhere
Self: Sized,
fn with_capacity(capacity: usize) -> Selfwhere
Self: Sized,
Returns new Buffer
with capacity
fn len(&self) -> usize
sourceunsafe fn extend_from_slice(&mut self, src: &[u8])
unsafe fn extend_from_slice(&mut self, src: &[u8])
sourcefn reserve(&mut self, additional: 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