Struct tikv_util::buffer_vec::BufferVec[][src]

pub struct BufferVec {
    data: Vec<u8>,
    offsets: Vec<usize>,
}

A vector like container storing multiple buffers. Each buffer is a [u8] slice in arbitrary length.

Fields

data: Vec<u8>offsets: Vec<usize>

Implementations

impl BufferVec[src]

pub fn new() -> Self[src]

Constructs a new, empty BufferVec.

The BufferVec will not allocate until buffers are pushed onto it.

pub fn with_capacity(elements_capacity: usize, data_capacity: usize) -> Self[src]

Constructs a new, empty BufferVec with the specified element capacity and data capacity.

pub fn capacity(&self) -> usize[src]

Returns the number of buffers this BufferVec can hold without reallocating the offsets array.

pub fn data_capacity(&self) -> usize[src]

Returns the number of buffers this BufferVec can hold without reallocating the data array.

pub fn len(&self) -> usize[src]

Returns the number of contained buffers.

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

Returns true if there is no contained buffer.

pub fn total_len(&self) -> usize[src]

Returns the total length of all contained buffers.

pub fn push(&mut self, buffer: impl AsRef<[u8]>)[src]

Appends a buffer to the back.

pub fn concat_extend<T, I>(&mut self, buffer_parts: I) where
    T: AsRef<[u8]>,
    I: IntoIterator<Item = T>, 
[src]

Appends multiple buffer parts together as one buffer to the back.

pub fn begin_concat_extend(&mut self) -> WithConcatExtend<'_>[src]

Returns a delegator that provides extend appends buffers together as one buffer to the back.

Note that this function always creates a new buffer even if you don’t call extend on the delegator later, which simply results in appending a new empty buffer.

pub fn pop(&mut self) -> Option<Vec<u8>>[src]

Removes the last buffer if there is any.

pub fn last(&self) -> Option<&[u8]>[src]

Get the last buffer if there is any.

pub fn shift(&mut self, n: usize)[src]

Removes the first n buffers.

If n >= current length, all buffers will be removed.

pub fn truncate(&mut self, n: usize)[src]

Shortens the BufferVec, keeping the first n buffers and dropping the rest.

If n >= current length, this has no effect.

pub fn clear(&mut self)[src]

Removes all buffers.

pub fn copy_from(&mut self, other: &BufferVec)[src]

Copies all buffers from other to self.

pub fn copy_n_from(&mut self, other: &BufferVec, n: usize)[src]

Copies first n buffers from other to self.

If n > other.len(), only other.len() buffers will be copied.

pub fn retain_by_array(&mut self, retain_arr: &[bool])[src]

Retains the elements according to a boolean array.

Panics

Panics if retain_arr is not long enough.

pub fn iter(&self) -> Iter<'_>

Notable traits for Iter<'a>

impl<'a> Iterator for Iter<'a> type Item = &'a [u8];
[src]

Returns an iterator over the BufferVec.

Trait Implementations

impl Clone for BufferVec[src]

impl Debug for BufferVec[src]

impl Default for BufferVec[src]

impl<'a> Extend<&'a u8> for BufferVec[src]

impl Extend<u8> for BufferVec[src]

impl Index<usize> for BufferVec[src]

type Output = [u8]

The returned type after indexing.

Auto Trait Implementations

impl RefUnwindSafe for BufferVec

impl Send for BufferVec

impl Sync for BufferVec

impl Unpin for BufferVec

impl UnwindSafe for BufferVec

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> Instrument for T[src]

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

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

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

type Output = T

Should always be Self

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

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]