pub trait VirtualStaticExtension<Discriminant: DiscriminantTag = ()>: Default {
type TypesVia: VirtualStaticExtensionSchema<Discriminant>;
// Required methods
fn access(
&self,
) -> <Self::TypesVia as VirtualStaticExtensionSchema<Discriminant>>::Repr;
fn mutate(
&mut self,
v: <Self::TypesVia as VirtualStaticExtensionSchema<Discriminant>>::Repr,
);
}Expand description
Allocation interface for virtual extensions whose type and schema are defined externally and fully determined at compile time.
This is the static counterpart to VirtualDynExtension, where
both type and structure are fixed via the schema.
§Context
In the static field model:
VirtualStaticFielddefines fields with fixed structureVirtualStaticExtensionSchemadefines externally supplied types and compile-time layoutVirtualStaticExtensionstores values using that schema
This allows a container (Self) to host externally defined fields
with statically determined structure.
§Representation
All operations are performed on the schema-defined representation:
TypesViadefinesNone,Some,Many, andReprManyis expected to have array-like semantics- size and capacity are encoded at compile time
§Semantics
-
Container (
Self)- owns storage
-
Schema (
TypesVia)- defines element type and representation
§Key Property
Both type and structure are fully determined at compile time, enabling zero-overhead representations without dynamic checks.
§Default Discriminant
Discriminant = (): defines a single default extension, meaning only one static extension is assumed.
Required Associated Types§
Sourcetype TypesVia: VirtualStaticExtensionSchema<Discriminant>
type TypesVia: VirtualStaticExtensionSchema<Discriminant>
External schema defining the extension.
Required Methods§
Sourcefn access(
&self,
) -> <Self::TypesVia as VirtualStaticExtensionSchema<Discriminant>>::Repr
fn access( &self, ) -> <Self::TypesVia as VirtualStaticExtensionSchema<Discriminant>>::Repr
Returns the underlying representation.
Sourcefn mutate(
&mut self,
v: <Self::TypesVia as VirtualStaticExtensionSchema<Discriminant>>::Repr,
)
fn mutate( &mut self, v: <Self::TypesVia as VirtualStaticExtensionSchema<Discriminant>>::Repr, )
Replaces the underlying representation.
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.