Trait VirtualStaticExtensionSchema

Source
pub trait VirtualStaticExtensionSchema<Discriminant: DiscriminantTag = ()> {
    type None: Delimited;
    type Some: Delimited;
    type Many: Collection<Self::Some>;
    type Repr: Delimited + Default + FromTag<Self::None, NoneTag> + TryIntoTag<Self::None, NoneTag> + FromTag<Self::Some, SomeTag> + TryIntoTag<Self::Some, SomeTag> + FromTag<Self::Many, ManyTag> + TryIntoTag<Self::Many, ManyTag>;
}
Expand description

Defines the schema for a VirtualStaticExtension identified by a Discriminant.

A VirtualStaticExtensionSchema describes the structure and representation of an extension field whose type is supplied externally and fully determined at compile time.

§Context

In the static field model:

This allows containers to support externally defined fields with compile-time determined structure.

§Representation

The Many form is expected to have array-like semantics:

  • fixed size
  • no dynamic resizing or allocation
  • capacity encoded in the type

The schema 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 static extension is assumed.

Required Associated Types§

Source

type None: Delimited

Representation of absence.

Source

type Some: Delimited

The logical element type defined by the schema.

This type is externally supplied.

Source

type Many: Collection<Self::Some>

A fixed-size collection of Some with array-like semantics.

Source

type Repr: Delimited + Default + FromTag<Self::None, NoneTag> + TryIntoTag<Self::None, NoneTag> + FromTag<Self::Some, SomeTag> + TryIntoTag<Self::Some, SomeTag> + FromTag<Self::Many, ManyTag> + TryIntoTag<Self::Many, ManyTag>

Opaque representation of the extension.

Encodes None, Some, or Many and supports tagged conversions.

All conversions are expected to be total (non-fallible), as structure is fully determined at compile time.

Implementors§