Struct tikv_util::buffer_vec::BufferVec [−][src]
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][−]
T: AsRef<[u8]>,
I: IntoIterator<Item = T>,
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][−]
pub fn iter(&self) -> Iter<'_>ⓘ
[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][+]
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][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
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][+]
U: From<T>,
impl<T> Pointable for T
[src][+]
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> Sealed<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src][+]
V: MultiLane<T>,