pub trait HistoryBufStorage<T>: HistoryBufSealedStorage<T> { }
Expand description
Trait defining how data for a container is stored.
There’s two implementations available:
OwnedHistoryBufStorage
: stores the data in an array[T; N]
whose size is known at compile time.ViewHistoryBufStorage
: stores the data in an unsized[T]
.
This allows HistoryBuf
to be generic over either sized or unsized storage. The histbuf
module contains a HistoryBufInner
struct that’s generic on HistoryBufStorage
,
and two type aliases for convenience:
HistoryBuf<T, N>
=HistoryBufInner<T, OwnedHistoryBufStorage<T, N>>
HistoryBufView<T>
=HistoryBufInner<T, ViewHistoryBufStorage<T>>
HistoryBuf
can be unsized into HistoryBufView
, either by unsizing coercions such as &mut HistoryBuf -> &mut HistoryBufView
or
Box<HistoryBuf> -> Box<HistoryBufView>
, 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.