pub struct SimpleTypeDef {Show 13 fields
pub name: Option<NameId>,
pub target_namespace: Option<NameId>,
pub source: Option<SourceRef>,
pub variety: SimpleTypeVariety,
pub derivation_method: SimpleTypeDerivationMethod,
pub base_type: Option<SimpleTypeRef>,
pub item_type: Option<SimpleTypeRef>,
pub member_types: Vec<SimpleTypeRef>,
pub facets: FacetSet,
pub type_code: XmlTypeCode,
pub primitive_type: Option<PrimitiveTypeCode>,
pub final_derivation: DerivationSet,
pub id: Option<String>,
}Expand description
Simple type definition
Represents an XSD simple type which can be atomic (restriction of base), list (whitespace-separated items), or union (one of multiple types).
Fields§
§name: Option<NameId>Name (None for anonymous types)
target_namespace: Option<NameId>Target namespace
source: Option<SourceRef>Source location for error reporting
variety: SimpleTypeVarietyType variety (atomic, list, or union)
derivation_method: SimpleTypeDerivationMethodDerivation method (restriction, list, or union)
base_type: Option<SimpleTypeRef>Base type definition (for atomic types derived by restriction)
item_type: Option<SimpleTypeRef>Item type (for list types)
member_types: Vec<SimpleTypeRef>Member types (for union types)
facets: FacetSetConstraining facets
type_code: XmlTypeCodeType code for built-in types (or derived types)
For built-in types, this is the corresponding XmlTypeCode. For user-defined types derived from built-in types, this may be set to the base type’s code for quick type checking.
primitive_type: Option<PrimitiveTypeCode>Primitive type code for atomic types
For atomic types, this indicates which primitive type they
ultimately derive from (one of the 19 XSD primitive types).
This is None for list types, union types, and abstract types.
final_derivation: DerivationSetFinal derivation control
id: Option<String>ID attribute value (for identity)
Implementations§
Source§impl SimpleTypeDef
impl SimpleTypeDef
Sourcepub fn new_restriction(
name: Option<NameId>,
target_namespace: Option<NameId>,
base_type: SimpleTypeRef,
) -> Self
pub fn new_restriction( name: Option<NameId>, target_namespace: Option<NameId>, base_type: SimpleTypeRef, ) -> Self
Create a new simple type with restriction variety
Sourcepub fn new_list(
name: Option<NameId>,
target_namespace: Option<NameId>,
item_type: SimpleTypeRef,
) -> Self
pub fn new_list( name: Option<NameId>, target_namespace: Option<NameId>, item_type: SimpleTypeRef, ) -> Self
Create a new list type
Sourcepub fn new_union(
name: Option<NameId>,
target_namespace: Option<NameId>,
member_types: Vec<SimpleTypeRef>,
) -> Self
pub fn new_union( name: Option<NameId>, target_namespace: Option<NameId>, member_types: Vec<SimpleTypeRef>, ) -> Self
Create a new union type
Sourcepub fn new_builtin(
name: NameId,
target_namespace: Option<NameId>,
builtin: BuiltInType,
) -> Self
pub fn new_builtin( name: NameId, target_namespace: Option<NameId>, builtin: BuiltInType, ) -> Self
Create a simple type for a built-in type
This constructor is used when registering built-in types with their proper type code and primitive type information.
Sourcepub fn is_anonymous(&self) -> bool
pub fn is_anonymous(&self) -> bool
Check if this is an anonymous type
Sourcepub fn is_restriction(&self) -> bool
pub fn is_restriction(&self) -> bool
Check if this type was derived by restriction
Sourcepub fn get_primitive_type(&self) -> Option<PrimitiveTypeCode>
pub fn get_primitive_type(&self) -> Option<PrimitiveTypeCode>
Get the primitive type code for this simple type
Returns the primitive type from which this type ultimately derives.
Returns None for list types, union types, and abstract types.
Sourcepub fn get_type_code(&self) -> XmlTypeCode
pub fn get_type_code(&self) -> XmlTypeCode
Get the type code for this simple type
Sourcepub fn type_key(&self, key: SimpleTypeKey) -> TypeKey
pub fn type_key(&self, key: SimpleTypeKey) -> TypeKey
Get the TypeKey for this simple type (requires its key)
Trait Implementations§
Source§impl Clone for SimpleTypeDef
impl Clone for SimpleTypeDef
Source§fn clone(&self) -> SimpleTypeDef
fn clone(&self) -> SimpleTypeDef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more