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
impl BuiltinType
Sourcepub fn name(self) -> &'static str
pub fn name(self) -> &'static str
The XSD-spec local name (e.g. "string", "nonNegativeInteger").
Sourcepub fn is_xsd11_only(self) -> bool
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.
Sourcepub fn default_whitespace(self) -> WhitespaceMode
pub fn default_whitespace(self) -> WhitespaceMode
Default whitespace mode per XSD §3.4.6. string preserves;
normalizedString replaces; everything else collapses.
Sourcepub fn is_integer_family(self) -> bool
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).
Sourcepub fn parent(self) -> Option<BuiltinType>
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).
Sourcepub fn primitive(self) -> BuiltinType
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).
Sourcepub fn derives_from(self, other: BuiltinType) -> bool
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.
Sourcepub fn from_name(name: &str) -> Option<BuiltinType>
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
impl Clone for BuiltinType
Source§fn clone(&self) -> BuiltinType
fn clone(&self) -> BuiltinType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for BuiltinType
Source§impl Debug for BuiltinType
impl Debug for BuiltinType
impl Eq for BuiltinType
Source§impl Hash for BuiltinType
impl Hash for BuiltinType
Source§impl PartialEq for BuiltinType
impl PartialEq for BuiltinType
Source§fn eq(&self, other: &BuiltinType) -> bool
fn eq(&self, other: &BuiltinType) -> bool
self and other values to be equal, and is used by ==.