Skip to main content

DynamicTypeBuilderFactory

Struct DynamicTypeBuilderFactory 

Source
pub struct DynamicTypeBuilderFactory;
Expand description

XTypes §7.5.5 DynamicTypeBuilderFactory — Singleton im Spec-Sinne.

Stateless: no global caches except the primitive singleton pool, which is lazily initialized via OnceLock.

Implementations§

Source§

impl DynamicTypeBuilderFactory

Source

pub fn create_type_w_type_object( type_obj: &TypeObject, ) -> Result<DynamicTypeBuilder, DynamicError>

Spec §7.6.4 / §7.5.5.1.4 create_type_w_type_object(type_object).

Scope:

  • CompleteStructType with primitive + string members.
  • MinimalStructType as read-only with hash names.
  • Other kinds: Unsupported.
§Errors

Unsupported for kinds outside the current implementation scope.

Source

pub fn create_type_w_type_object_in( type_obj: &TypeObject, registry: &TypeRegistry, ) -> Result<DynamicType, DynamicError>

Registry-aware create_type_w_type_object (XTypes §7.6.4 with a TypeLookupService). Unlike the bare overload, composite member types referenced by EquivalenceHash are resolved recursively against registry, so a struct/union with nested struct/union/enum/bitmask/ bitset MEMBERS yields a fully-populated DynamicType (members carry their own members). Covers all 10 top-level Complete kinds.

Residual (honest Unsupported, not silent): a COLLECTION whose element is itself a composite keeps a shallow element descriptor — the TypeDescriptor::element_type model holds a descriptor, not a full DynamicType, so sequence<NestedStruct> cannot yet carry the nested members (needs a model change); likewise Minimal TypeObjects and alias-to-composite targets.

§Errors

Unsupported for the residual cases above and unresolvable hashes.

Source§

impl DynamicTypeBuilderFactory

Source

pub fn create_type( descriptor: TypeDescriptor, ) -> Result<DynamicTypeBuilder, DynamicError>

Spec §7.5.5.1.1 create_type(descriptor).

§Errors

Inconsistent if the descriptor is invalid.

Source

pub fn create_struct(name: impl Into<String>) -> DynamicTypeBuilder

Convenience variant: creates a struct builder directly.

Source

pub fn create_union( name: impl Into<String>, discriminator: TypeDescriptor, ) -> Result<DynamicTypeBuilder, DynamicError>

Convenience variant: creates a union builder directly with the given discriminator type.

§Errors

Inconsistent if the discriminator is not permitted.

Source

pub fn get_primitive_type(kind: TypeKind) -> Result<DynamicType, DynamicError>

Spec §7.5.5.1.2 get_primitive_type(kind) — Singleton-Cache.

Repeated calls with the same kind return the same DynamicType instance (same Arc pointer).

§Errors

IllegalOperation if kind is not a primitive.

Source

pub fn create_string_type(bound: u32) -> DynamicType

Spec §7.5.5.1.3 create_string_type(bound) — bounded string<N>.

Source

pub fn create_wstring_type(bound: u32) -> DynamicType

Spec §7.5.5.1.4 create_wstring_type(bound).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.