Trait StaticFieldHelpers

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

Helper methods for accessing and mutating values in a VirtualStaticField.

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

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

All operations are performed via tagged conversions.

§Default Discriminant

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

Provided Methods§

Source

fn get_all(&self) -> Option<Self::Many>

Retrieves the full collection from the field interpreted as Many.

§Behavior
  • Returns Some(V) if the field is in Many form
  • Returns None if the field is None or Some
Source

fn set_all(&mut self, v: Self::Many)
where Self::Many: Delimited,

Sets the field to a collection (Many).

§Behavior
  • Replaces the entire field with the provided collection
  • No resizing or partial updates are performed
Source

fn get(&self) -> Option<Self::Some>

Retrieves the value of the field interpreted as Some.

§Behavior
  • Returns Some(V) if the field contains a single value
  • Returns None otherwise
Source

fn set(&mut self, v: Self::Some)
where Self::Some: Delimited,

Sets the field to a single value (Some).

Replaces any existing 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.

Implementors§

Source§

impl<T, K> StaticFieldHelpers<K> for T

Blanket impl for all VirtualStaticField 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.