pub trait Buffer {
type Freeze;
fn with_capacity(capacity: usize) -> Self;
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) -> Self
fn with_capacity(capacity: usize) -> Self
Returns new Buffer
with capacity
sourceunsafe fn extend_from_slice(&mut self, src: &[u8])
unsafe fn extend_from_slice(&mut self, src: &[u8])
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