[][src]Trait v_escape::Buffer

pub trait Buffer {
    type Freeze;
    pub fn with_capacity(capacity: usize) -> Self;
pub fn is_empty(&self) -> bool;
pub fn extend_from_slice(&mut self, src: &[u8]);
pub fn reserve(&mut self, additional: usize);
pub fn freeze(self) -> Self::Freeze;
pub unsafe fn advance(&mut self, cnt: usize);
pub unsafe fn buf_ptr(&mut self) -> *mut u8; }

Minimal Buffer trait

Associated Types

type Freeze[src]

Into immutable type

Loading content...

Required methods

pub fn with_capacity(capacity: usize) -> Self[src]

Returns new Buffer with capacity

pub fn is_empty(&self) -> bool[src]

Returns true if the Buffer has a length of 0.

pub fn extend_from_slice(&mut self, src: &[u8])[src]

Appends given bytes to this Buffer.

Panics

Can panic if current length plus src length overflows usize

pub fn reserve(&mut self, additional: usize)[src]

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

pub fn freeze(self) -> Self::Freeze[src]

Converts self into a Freeze type

pub unsafe fn advance(&mut self, cnt: usize)[src]

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

pub unsafe fn buf_ptr(&mut self) -> *mut u8[src]

Return unsafe ptr to current Buffer position

Safety

If buffer is full, can return invalid pointer

Loading content...

Implementations on Foreign Types

impl Buffer for Vec<u8, Global>[src]

type Freeze = Vec<u8, Global>

impl Buffer for BytesMut[src]

type Freeze = Bytes

Loading content...

Implementors

Loading content...