pub unsafe trait StorageWithCapacity: Storage + Sized {
// Required method
fn with_capacity(capacity: usize) -> Self;
}Expand description
A storage that can be initially created with a given capacity
§Safety
The storage must have a capacity of at least capacity after
StorageWithCapacity::with_capacity is called.
Required Methods§
Sourcefn with_capacity(capacity: usize) -> Self
fn with_capacity(capacity: usize) -> Self
Creates a new storage with at least the given storage 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.
Implementations on Foreign Types§
Source§impl<T, A: Default + Allocator> StorageWithCapacity for Box<[MaybeUninit<T>], A>
Available on (crate features alloc) and (crate features nightly) only.
impl<T, A: Default + Allocator> StorageWithCapacity for Box<[MaybeUninit<T>], A>
Available on (crate features
alloc) and (crate features nightly) only.fn with_capacity(cap: usize) -> Self
Source§impl<T, const N: usize> StorageWithCapacity for [MaybeUninit<T>; N]
impl<T, const N: usize> StorageWithCapacity for [MaybeUninit<T>; N]
fn with_capacity(capacity: usize) -> Self
Implementors§
impl<S: ?Sized + StorageWithCapacity> StorageWithCapacity for BoxStorage<S>
Available on crate features
alloc only.