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]
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = &'a u8>,
[src]
I: IntoIterator<Item = &'a u8>,
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl Extend<u8> for BufferVec
[src]
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = u8>,
[src]
I: IntoIterator<Item = u8>,
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[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,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,