pub trait LinearMapStorage<K, V>: LinearMapStorageSealed<K, V> { }
Expand description
Trait defining how data for a LinearMap
is stored.
There’s two implementations available:
OwnedStorage
: stores the data in an array whose size is known at compile time.ViewStorage
: stores the data in an unsized slice
This allows LinearMap
to be generic over either sized or unsized storage. The linear_map
module contains a LinearMapInner
struct that’s generic on LinearMapStorage
,
and two type aliases for convenience:
LinearMap<N>
=LinearMapInner<OwnedStorage<u8, N>>
LinearMapView<T>
=LinearMapInner<ViewStorage<u8>>
LinearMap
can be unsized into StrinsgView
, either by unsizing coercions such as &mut LinearMap -> &mut LinearMapView
or
Box<LinearMap> -> Box<LinearMapView>
, or explicitly with .as_view()
or .as_mut_view()
.
This trait is sealed, so you cannot implement it for your own types. You can only use the implementations provided by this crate.
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.