Struct timely::communication::allocator::zero_copy::bytes_slab::BytesSlab[][src]

pub struct BytesSlab { /* fields omitted */ }

A large binary allocation for writing and sharing.

A bytes slab wraps a Bytes and maintains a valid (written) length, and supports writing after this valid length, and extracting Bytes up to this valid length. Extracted bytes are enqueued and checked for uniqueness in order to recycle them (once all shared references are dropped).

Implementations

impl BytesSlab[src]

pub fn new(shift: usize) -> BytesSlab[src]

Allocates a new BytesSlab with an initial size determined by a shift.

pub fn empty(&mut self) -> &mut [u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

The empty region of the slab.

pub fn valid(&mut self) -> &mut [u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

The valid region of the slab.

pub fn make_valid(&mut self, bytes: usize)[src]

Marks the next bytes bytes as valid.

pub fn extract(&mut self, bytes: usize) -> Bytes[src]

Extracts the first bytes valid bytes.

pub fn ensure_capacity(&mut self, capacity: usize)[src]

Ensures that self.empty().len() is at least capacity.

This method may retire the current buffer if it does not have enough space, in which case it will copy any remaining contents into a new buffer. If this would not create enough free space, the shift is increased until it is sufficient.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.