pub trait VariadicStruct<'a>: Clone {
type Item: VariadicRef;
type ItemMut;
// Required methods
fn create(data: TypeIndex, _: &'a [u8]) -> Self::Item;
fn create_mut(data: &'a mut Vec<u8>) -> Self::ItemMut;
}
Expand description
A type used to create VariadicStructs.
Vector/ArrayView-like classes cannot be directly implemented over the structs since that binds lifetime too early. Instead this generic factory and Higher-Rank-Trait-Bounds are used to emulate higher-kinded-generics.
Required Associated Types§
Sourcetype Item: VariadicRef
type Item: VariadicRef
Reader type
Sourcetype ItemMut
type ItemMut
Associated type used for building an item in MultiVector
based on
this variadic type.
The builder is returned by
MultiVector::grow
method. It provides convenient methods add_{variant_name}
for each
enum variant.
Required Methods§
Sourcefn create(data: TypeIndex, _: &'a [u8]) -> Self::Item
fn create(data: TypeIndex, _: &'a [u8]) -> Self::Item
Creates a reader for specific type of data.
Sourcefn create_mut(data: &'a mut Vec<u8>) -> Self::ItemMut
fn create_mut(data: &'a mut Vec<u8>) -> Self::ItemMut
Creates a builder for a list of VariadicRef.
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.