Skip to main content

BuiltinType

Enum BuiltinType 

Source
pub enum BuiltinType {
Show 50 variants AnySimpleType, String, Boolean, Decimal, Float, Double, Duration, DateTime, Time, Date, GYearMonth, GYear, GMonthDay, GDay, GMonth, HexBinary, Base64Binary, AnyUri, QName, Notation, NormalizedString, Token, Language, NmToken, NmTokens, Name, NCName, Id, IdRef, IdRefs, Entity, Entities, Integer, NonPositiveInteger, NegativeInteger, Long, Int, Short, Byte, NonNegativeInteger, UnsignedLong, UnsignedInt, UnsignedShort, UnsignedByte, PositiveInteger, DateTimeStamp, DayTimeDuration, YearMonthDuration, AnyAtomicType, Error,
}
Expand description

One of the XSD built-in datatypes. Simple types defined in user schemas reference one of these as their ultimate base.

Variants§

§

AnySimpleType

XSD §3.16.1 — the ur-simple-type: implicit base of every simple type. Imposes no constraint beyond “is a string”; any post-whitespace lexical value is accepted.

§

String

§

Boolean

§

Decimal

§

Float

§

Double

§

Duration

§

DateTime

§

Time

§

Date

§

GYearMonth

§

GYear

§

GMonthDay

§

GDay

§

GMonth

§

HexBinary

§

Base64Binary

§

AnyUri

§

QName

§

Notation

§

NormalizedString

§

Token

§

Language

§

NmToken

§

NmTokens

§

Name

§

NCName

§

Id

§

IdRef

§

IdRefs

§

Entity

§

Entities

§

Integer

§

NonPositiveInteger

§

NegativeInteger

§

Long

§

Int

§

Short

§

Byte

§

NonNegativeInteger

§

UnsignedLong

§

UnsignedInt

§

UnsignedShort

§

UnsignedByte

§

PositiveInteger

§

DateTimeStamp

Restriction of xs:dateTime requiring a timezone offset (explicitTimezone="required"). Lexical form is identical to xs:dateTime; the only difference is that values without a trailing Z / ±HH:MM are rejected.

§

DayTimeDuration

Restriction of xs:duration allowing only D / H / M / S components — P1Y and P2M are invalid.

§

YearMonthDuration

Restriction of xs:duration allowing only Y / M components — P1D, PT1H, etc. are invalid.

§

AnyAtomicType

Abstract supertype of every atomic primitive (the new intermediate node between xs:anySimpleType and the primitives). Cannot be used to validate an instance directly; only as a base in a restriction chain.

§

Error

The type whose value space is empty. Every instance value is rejected. Used together with xs:alternative to mark a conditional branch as “this case is an error.”

Implementations§

Source§

impl BuiltinType

Source

pub fn name(self) -> &'static str

The XSD-spec local name (e.g. "string", "nonNegativeInteger").

Source

pub fn is_xsd11_only(self) -> bool

True for the five built-in types added in XSD 1.1. The schema compiler rejects these as a base= reference when running in strict 1.0 mode.

Source

pub fn default_whitespace(self) -> WhitespaceMode

Default whitespace mode per XSD §3.4.6. string preserves; normalizedString replaces; everything else collapses.

Source

pub fn is_integer_family(self) -> bool

True for xs:integer and the integer subtypes (Long, Int, Short, Byte, NonPositiveInteger, NegativeInteger, NonNegativeInteger, PositiveInteger, UnsignedLong, UnsignedInt, UnsignedShort, UnsignedByte).

Source

pub fn parent(self) -> Option<BuiltinType>

The XSD-spec parent built-in, or None for the 19 primitives that derive directly from xs:anySimpleType. Used by xsi:type derivation checks so a substituted built-in is recognised as a restriction of its declared base (e.g. xs:integer xs:decimal).

Source

pub fn primitive(self) -> BuiltinType

Walk the parent chain to the spec’s PRIMITIVE built-in (the 19 that derive directly from xs:anySimpleType). Two values of types sharing a primitive ancestor compare equal in the value space — that’s the identity-constraint equality basis per XSD 1.0 §3.11.4 cvc-identity-constraint.4.2.2 / F&O op:numeric-equal, op:string-equal, etc. Self if already a primitive (or a non-derived special like anySimpleType / anyAtomicType / error whose chain stops here).

Source

pub fn derives_from(self, other: BuiltinType) -> bool

True when self derives from other in the built-in hierarchy (including identity). Always a chain of restrictions per XSD §3.16.6.

Source

pub fn from_name(name: &str) -> Option<BuiltinType>

Look up a built-in by its XSD local name (case-sensitive).

Trait Implementations§

Source§

impl Clone for BuiltinType

Source§

fn clone(&self) -> BuiltinType

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 Copy for BuiltinType

Source§

impl Debug for BuiltinType

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for BuiltinType

Source§

impl Hash for BuiltinType

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BuiltinType

Source§

fn eq(&self, other: &BuiltinType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for BuiltinType

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

Source§

type Output = T

Should always be Self
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.