pub trait TursoVecExt<T>: Sized {
// Required methods
fn with_capacity(capacity: usize) -> Self;
fn push_within_capacity(&mut self, value: T) -> Result<&mut T, T>;
fn try_push(&mut self, value: T) -> Result<(), TryReserveError>;
}Required Methods§
fn with_capacity(capacity: usize) -> Self
Sourcefn push_within_capacity(&mut self, value: T) -> Result<&mut T, T>
fn push_within_capacity(&mut self, value: T) -> Result<&mut T, T>
Appends an element and returns a reference to it if there is sufficient spare capacity, otherwise an error is returned with the element.
Unlike push, this method does not reallocate when capacity is exhausted. Callers should
reserve capacity before using this when insertion must succeed.
Mirrors the unstable standard library implementation: https://doc.rust-lang.org/src/alloc/vec/mod.rs.html#2786
Takes O(1) time.
fn try_push(&mut self, value: T) -> Result<(), TryReserveError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<T> TursoVecExt<T> for Vec<T>
Available on non-
nightly only.