pub trait Storage<T>{
type Error: 'static;
const EMPTY: Self;
// Required methods
fn with_capacity(capacity: usize) -> Result<Self, Self::Error>;
fn capacity(&self) -> usize;
fn push(&mut self, item: T) -> Result<(), Self::Error>;
// Provided method
fn reserve(&mut self, additional: usize) -> Result<(), Self::Error> { ... }
}Expand description
Storage being used in a tree.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn with_capacity(capacity: usize) -> Result<Self, Self::Error>
fn with_capacity(capacity: usize) -> Result<Self, Self::Error>
Construct storage with the given capacity.
Fixed-capacity storage should error if capacity doesn’t fit.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T> Storage<T> for Vec<T>
Available on crate feature alloc only.
impl<T> Storage<T> for Vec<T>
Available on crate feature
alloc only.Source§fn with_capacity(capacity: usize) -> Result<Self, Self::Error>
fn with_capacity(capacity: usize) -> Result<Self, Self::Error>
Capacity is a hint, and is ignored if it can’t be allocated.
Source§fn reserve(&mut self, additional: usize) -> Result<(), Self::Error>
fn reserve(&mut self, additional: usize) -> Result<(), Self::Error>
Capacity is a hint, and is ignored if it can’t be allocated.