Skip to main content

SimpleTypeDef

Struct SimpleTypeDef 

Source
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: SimpleTypeVariety

Type variety (atomic, list, or union)

§derivation_method: SimpleTypeDerivationMethod

Derivation 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: FacetSet

Constraining facets

§type_code: XmlTypeCode

Type 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: DerivationSet

Final derivation control

§id: Option<String>

ID attribute value (for identity)

Implementations§

Source§

impl SimpleTypeDef

Source

pub fn new_restriction( name: Option<NameId>, target_namespace: Option<NameId>, base_type: SimpleTypeRef, ) -> Self

Create a new simple type with restriction variety

Source

pub fn new_list( name: Option<NameId>, target_namespace: Option<NameId>, item_type: SimpleTypeRef, ) -> Self

Create a new list type

Source

pub fn new_union( name: Option<NameId>, target_namespace: Option<NameId>, member_types: Vec<SimpleTypeRef>, ) -> Self

Create a new union type

Source

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.

Source

pub fn is_anonymous(&self) -> bool

Check if this is an anonymous type

Source

pub fn is_global(&self) -> bool

Check if this is a global (named) type

Source

pub fn is_atomic(&self) -> bool

Check if this is an atomic type

Source

pub fn is_list(&self) -> bool

Check if this is a list type

Source

pub fn is_union(&self) -> bool

Check if this is a union type

Source

pub fn is_restriction(&self) -> bool

Check if this type was derived by restriction

Source

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.

Source

pub fn get_type_code(&self) -> XmlTypeCode

Get the type code for this simple type

Source

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

Source§

fn clone(&self) -> SimpleTypeDef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SimpleTypeDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> MaybeSendSync for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.