pub trait StorageProvider<T> {
type StorageType: Storage<T>;
// Required methods
fn new() -> Self;
fn new_storage(&mut self) -> Self::StorageType;
fn storage_with_capacity(&mut self, capacity: usize) -> Self::StorageType;
}Expand description
A trait for represting the underlying storage container or mechanism family.
Required Associated Types§
Sourcetype StorageType: Storage<T>
type StorageType: Storage<T>
The storage type that this family provides for T type elements.
Required Methods§
Sourcefn new_storage(&mut self) -> Self::StorageType
fn new_storage(&mut self) -> Self::StorageType
Create a new storage instance.
Sourcefn storage_with_capacity(&mut self, capacity: usize) -> Self::StorageType
fn storage_with_capacity(&mut self, capacity: usize) -> Self::StorageType
Create a new storage instance with at least capacity capacity.
Is allowed to panic if the storage type cannot support the requested capacity.
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.