pub trait VirtualDynExtensionSchema<Discriminant: DiscriminantTag = ()> {
type None: Delimited;
type Some: Delimited;
type Many: Buffer<Self::Some> + Indexable<Self::Some>;
type Repr: Delimited + Default + FromTag<Self::None, NoneTag> + TryIntoTag<Self::None, NoneTag> + FromTag<Self::Some, SomeTag> + TryIntoTag<Self::Some, SomeTag> + TryFromTag<Self::Many, ManyTag> + IntoTag<Self::Many, ManyTag>;
// Required methods
fn len(v: &Self::Repr) -> usize;
fn min(v: &Self::Repr) -> usize;
fn max(v: &Self::Repr) -> usize;
}Expand description
Defines the schema for a VirtualDynExtension identified by a Discriminant.
A VirtualDynExtensionSchema describes the structure and representation
of an extension field whose type is supplied externally.
Unlike VirtualDynField, the element type and layout are not defined
by the container, but provided through this schema.
§Context
In the virtual system:
VirtualDynFielddefines fields with internally known typesVirtualDynExtensionSchemadefines fields with externally supplied typesVirtualDynExtensionstores values using this schema
This allows containers to support fields whose types are:
- not known at implementation time
- injected via type-level composition
§Representation
The Many form is expected to have vector-like semantics:
- dynamically sized (within bounds)
- supports buffering and indexed access
The schema itself is purely type-level:
- it does not store data
- it defines how data is represented and interpreted
§Discriminant
The Discriminant links:
- the extension storage
- to its schema
allowing multiple independent extensions to coexist safely.
§Default Discriminant
Discriminant = (): defines a single default extension schema, meaning only one extension is assumed.
Required Associated Types§
Sourcetype Some: Delimited
type Some: Delimited
The logical element type defined by the schema.
This type is externally supplied.
Sourcetype Many: Buffer<Self::Some> + Indexable<Self::Some>
type Many: Buffer<Self::Some> + Indexable<Self::Some>
A collection of Some with vector-like semantics.
Sourcetype Repr: Delimited + Default + FromTag<Self::None, NoneTag> + TryIntoTag<Self::None, NoneTag> + FromTag<Self::Some, SomeTag> + TryIntoTag<Self::Some, SomeTag> + TryFromTag<Self::Many, ManyTag> + IntoTag<Self::Many, ManyTag>
type Repr: Delimited + Default + FromTag<Self::None, NoneTag> + TryIntoTag<Self::None, NoneTag> + FromTag<Self::Some, SomeTag> + TryIntoTag<Self::Some, SomeTag> + TryFromTag<Self::Many, ManyTag> + IntoTag<Self::Many, ManyTag>
Opaque representation of the extension.
Encodes None, Some, or Many and supports tagged conversions.
Required Methods§
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.