Trait StaticExtHelpers

Source
pub trait StaticExtHelpers<K = ()>: VirtualStaticExtension<K>
where K: DiscriminantTag,
{ // Provided methods fn get_all( &self, ) -> Option<<Self::TypesVia as VirtualStaticExtensionSchema<K>>::Many> { ... } fn set_all( &mut self, v: <Self::TypesVia as VirtualStaticExtensionSchema<K>>::Many, ) where <Self::TypesVia as VirtualStaticExtensionSchema<K>>::Many: Delimited { ... } fn get( &self, ) -> Option<<Self::TypesVia as VirtualStaticExtensionSchema<K>>::Some> { ... } fn set( &mut self, v: <Self::TypesVia as VirtualStaticExtensionSchema<K>>::Some, ) { ... } }
Expand description

Helper methods for accessing and mutating values in a VirtualStaticExtension.

These helpers operate on statically shaped extensions with array-like semantics:

  • collection size is fixed at compile time
  • no resizing or extension is performed
  • operations act on the entire structure

Structure and types are defined externally via VirtualStaticExtensionSchema, while storage is handled by the container.

All operations are performed via tagged conversions.

§Default Discriminant

  • K = (): operates on a single default extension, meaning one static extension is assumed.

Provided Methods§

Source

fn get_all( &self, ) -> Option<<Self::TypesVia as VirtualStaticExtensionSchema<K>>::Many>

Retrieves the full collection (Many).

Source

fn set_all( &mut self, v: <Self::TypesVia as VirtualStaticExtensionSchema<K>>::Many, )

Sets full collection.

Source

fn get( &self, ) -> Option<<Self::TypesVia as VirtualStaticExtensionSchema<K>>::Some>

Retrieves Some.

Source

fn set(&mut self, v: <Self::TypesVia as VirtualStaticExtensionSchema<K>>::Some)

Sets Some.

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.

Implementors§

Source§

impl<T, K> StaticExtHelpers<K> for T

Blanket impl for all VirtualStaticExtension types.

This trait is not intended to be implemented manually. It exists as an ergonomic replacement for free helper functions.

All methods have default implementations, making this forward-compatible: new helpers can be added without breaking existing code.