pub struct DynamicType { /* private fields */ }Expand description
XTypes 1.3 §7.5.3 DynamicType.
Read-only API onto a type constructed at runtime. DynamicTypes are
created exclusively via DynamicTypeBuilder::build
or DynamicTypeBuilderFactory::get_primitive_type.
Implementations§
Source§impl DynamicType
impl DynamicType
Sourcepub fn to_type_object(&self) -> Result<TypeObject, DynamicError>
pub fn to_type_object(&self) -> Result<TypeObject, DynamicError>
Spec §7.6.3 — converts this DynamicType into a
CompleteTypeObject. Always returns complete (not minimal),
because DynamicType carries the names + annotations.
Scope:
- Struct with primitive + string + sequence/array members.
- Union, enum, alias as their own helper methods (see module doc).
§Errors
Unsupported for not-yet-implemented kinds,
Inconsistent if the type is malformed.
Source§impl DynamicType
impl DynamicType
Sourcepub fn descriptor(&self) -> &TypeDescriptor
pub fn descriptor(&self) -> &TypeDescriptor
Spec §7.5.3.1 get_descriptor().
Sourcepub fn member_count(&self) -> u32
pub fn member_count(&self) -> u32
Spec §7.5.3.4.1 get_member_count().
Sourcepub fn member_by_index(&self, index: u32) -> Option<&DynamicTypeMember>
pub fn member_by_index(&self, index: u32) -> Option<&DynamicTypeMember>
Spec §7.5.3.4.4 get_member_by_index(index).
Sourcepub fn member_by_id(&self, id: MemberId) -> Option<&DynamicTypeMember>
pub fn member_by_id(&self, id: MemberId) -> Option<&DynamicTypeMember>
Spec §7.5.3.4.2 get_member(MemberId).
Sourcepub fn member_by_name(&self, name: &str) -> Option<&DynamicTypeMember>
pub fn member_by_name(&self, name: &str) -> Option<&DynamicTypeMember>
Spec §7.5.3.4.3 get_member_by_name(name).
Sourcepub fn members(&self) -> impl Iterator<Item = &DynamicTypeMember>
pub fn members(&self) -> impl Iterator<Item = &DynamicTypeMember>
Iterator over all members in index order.
Sourcepub fn is_aggregable(&self) -> bool
pub fn is_aggregable(&self) -> bool
True if the type is a composite type (carries members).
Sourcepub fn is_consistent(&self) -> Result<(), DynamicError>
pub fn is_consistent(&self) -> Result<(), DynamicError>
Validates that the type is overall consistent (Spec §7.5.3.5
- block-A constraints + member consistency).
§Errors
DynamicError::Inconsistent with detail.
Sourcepub fn new_primitive(kind: TypeKind) -> Self
pub fn new_primitive(kind: TypeKind) -> Self
Convenience: creates a primitive DynamicType for type bridges.
For reused primitives, prefer
crate::dynamic::DynamicTypeBuilderFactory::get_primitive_type
(singleton cache).
Trait Implementations§
Source§impl Clone for DynamicType
impl Clone for DynamicType
Source§fn clone(&self) -> DynamicType
fn clone(&self) -> DynamicType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more