pub trait VecLike<T>: BufferData<T> + Extend<T> {
// Required methods
fn capacity(&self) -> usize;
fn push(&mut self, value: T);
fn clear(&mut self);
fn resize(&mut self, new_len: usize, value: T)
where T: Clone;
fn extend_from_slice(&mut self, other: &[T])
where T: Clone;
fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<T>];
unsafe fn set_len(&mut self, new_len: usize);
}Expand description
A growable, Vec-like buffer.
Abstracts the buffer surface the prover uses: BufferData plus a subset of Vec’s API.
Implemented by Vec<T> and PoolVec, with methods added as callers need them.
It is not meant to mirror all of Vec.
Required Methods§
Sourcefn capacity(&self) -> usize
fn capacity(&self) -> usize
Returns the number of elements the buffer can hold without reallocating.
Sourcefn resize(&mut self, new_len: usize, value: T)where
T: Clone,
fn resize(&mut self, new_len: usize, value: T)where
T: Clone,
Resizes the buffer to new_len, filling any new slots with value.
Sourcefn extend_from_slice(&mut self, other: &[T])where
T: Clone,
fn extend_from_slice(&mut self, other: &[T])where
T: Clone,
Appends all elements of other to the back of the buffer.
Sourcefn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<T>]
fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<T>]
Returns the spare capacity of the buffer as a slice of MaybeUninit<T>.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.