Trait v_escape::Buffer[][src]

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

Associated Types

Into immutable type

Required methods

Returns new Buffer with capacity

Returns true if the Buffer has a length of 0.

Appends given bytes to this Buffer.

Safety

Broke utf-8 safety

Panics

Can panic if current length plus src length overflows 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

Converts self into a Freeze type

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

Return unsafe ptr to current Buffer position

Safety

If buffer is full, can return invalid pointer

Provided methods

Appends given str to this Buffer.

Panics

Can panic if current length plus src length overflows usize

Implementations on Foreign Types

Implementors