StorageProvider

Trait StorageProvider 

Source
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§

Source

type StorageType: Storage<T>

The storage type that this family provides for T type elements.

Required Methods§

Source

fn new() -> Self

Create a new storage provider.

Source

fn new_storage(&mut self) -> Self::StorageType

Create a new storage instance.

Source

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.

Implementors§