Expand description
This crate aims at providing safe representations of XSD built-in data types.
§Usage
For each XSD datatype, this library provides two families of types:
one representing the lexical space of the datatype (see the lexical
module), and one representing the value space of the datatype (see the
value
module).
For instance, assume we wish to store the lexical representation of an
XSD decimal datatype value. We can use the
lexical::Decimal
type (or its owned variant, lexical::DecimalBuf
)
let string = "3.141592653589793";
// Parse the lexical representation (lexical domain).
let lexical_repr = xsd_types::lexical::Decimal::new(string).unwrap();
// Interprets the lexical representation (value domain).
use xsd_types::lexical::LexicalFormOf;
let value_repr: xsd_types::Decimal = lexical_repr.try_as_value().unwrap();
Of course it is possible to parse the value directly into the value domain
using FromStr
:
let value_repr: xsd_types::Decimal = "3.141592653589793".parse().unwrap();
§Any value
The Value
type provides a simple way to represent any XSD value.
use xsd_types::{XSD_DATE, Datatype, Value};
let dt = Datatype::from_iri(XSD_DATE).unwrap();
let value: Value = dt.parse("1758-12-25").unwrap(); // Halley is back!
Re-exports§
pub use value::*;
Modules§
- Lexical domain types.
- Value domain types.
Structs§
- XSD value parse error.
Enums§
- XSD datatype (primitive or not).
DateTime
datatype variants.- Any specialized
DateTime
value. Decimal
datatype variants.- Any specialized
Decimal
value. - Any specialized
Decimal
value reference. Duration
datatype variants.- Any specialized
Duration
value. Int
datatype variants.- Any specialized
Int
value. Integer
datatype variants.- Any specialized
Integer
value. - Any specialized
Integer
value reference. Long
datatype variants.- Any specialized
Long
value. NCName
datatype variants.- Any specialized
NCName
value. - Any specialized
NCName
value reference. Name
datatype variants.- Any specialized
Name
value. - Any specialized
Name
value reference. NonNegativeInteger
datatype variants.- Any specialized
NonNegativeInteger
value. - Any specialized
NonNegativeInteger
value reference. NonPositiveInteger
datatype variants.- Any specialized
NonPositiveInteger
value. - Any specialized
NonPositiveInteger
value reference. NormalizedStr
datatype variants.- Any specialized
NormalizedStr
value. - Any specialized
NormalizedStr
value reference. - XSD lexical parse error.
- XSD primitive datatype.
Short
datatype variants.- Any specialized
Short
value. str
datatype variants.- Any specialized
str
value. - Any specialized
str
value reference. Token
datatype variants.- Any specialized
Token
value. - Any specialized
Token
value reference. UnsignedInt
datatype variants.- Any specialized
UnsignedInt
value. UnsignedLong
datatype variants.- Any specialized
UnsignedLong
value. UnsignedShort
datatype variants.- Any specialized
UnsignedShort
value. - Any XSD value.
- Any XSD value reference.
Constants§
- http://www.w3.org/2001/XMLSchema#anyURI datatype IRI.
- http://www.w3.org/2001/XMLSchema#base64Binary datatype IRI.
- http://www.w3.org/2001/XMLSchema#boolean datatype IRI.
- http://www.w3.org/2001/XMLSchema#byte datatype IRI.
- http://www.w3.org/2001/XMLSchema#date datatype IRI.
- http://www.w3.org/2001/XMLSchema#dateTime datatype IRI.
- http://www.w3.org/2001/XMLSchema#dateTimeStamp datatype IRI.
- http://www.w3.org/2001/XMLSchema#dayTimeDuration datatype IRI.
- http://www.w3.org/2001/XMLSchema#decimal datatype IRI.
- http://www.w3.org/2001/XMLSchema#double datatype IRI.
- http://www.w3.org/2001/XMLSchema#duration datatype IRI.
- http://www.w3.org/2001/XMLSchema#ENTITIES datatype IRI.
- http://www.w3.org/2001/XMLSchema#ENTITY datatype IRI.
- http://www.w3.org/2001/XMLSchema#float datatype IRI.
- http://www.w3.org/2001/XMLSchema#gDay datatype IRI.
- http://www.w3.org/2001/XMLSchema#gMonth datatype IRI.
- http://www.w3.org/2001/XMLSchema#gMonthDay datatype IRI.
- http://www.w3.org/2001/XMLSchema#gYear datatype IRI.
- http://www.w3.org/2001/XMLSchema#gYearMonth datatype IRI.
- http://www.w3.org/2001/XMLSchema#hexBinary datatype IRI.
- http://www.w3.org/2001/XMLSchema#ID datatype IRI.
- http://www.w3.org/2001/XMLSchema#IDREF datatype IRI.
- http://www.w3.org/2001/XMLSchema#IDREFS datatype IRI.
- http://www.w3.org/2001/XMLSchema#int datatype IRI.
- http://www.w3.org/2001/XMLSchema#integer datatype IRI.
- http://www.w3.org/2001/XMLSchema#language datatype IRI.
- http://www.w3.org/2001/XMLSchema#long datatype IRI.
- http://www.w3.org/2001/XMLSchema#Name datatype IRI.
- http://www.w3.org/2001/XMLSchema#NCName datatype IRI.
- http://www.w3.org/2001/XMLSchema#negativeInteger datatype IRI.
- http://www.w3.org/2001/XMLSchema#NMTOKEN datatype IRI.
- http://www.w3.org/2001/XMLSchema#NMTOKENS datatype IRI.
- http://www.w3.org/2001/XMLSchema#nonNegativeInteger datatype IRI.
- http://www.w3.org/2001/XMLSchema#nonPositiveInteger datatype IRI.
- http://www.w3.org/2001/XMLSchema#normalizedString datatype IRI.
- http://www.w3.org/2001/XMLSchema#NOTATION datatype IRI.
- http://www.w3.org/2001/XMLSchema#positiveInteger datatype IRI.
- http://www.w3.org/2001/XMLSchema#QName datatype IRI.
- http://www.w3.org/2001/XMLSchema#short datatype IRI.
- http://www.w3.org/2001/XMLSchema#string datatype IRI.
- http://www.w3.org/2001/XMLSchema#time datatype IRI.
- http://www.w3.org/2001/XMLSchema#token datatype IRI.
- http://www.w3.org/2001/XMLSchema#unsignedByte datatype IRI.
- http://www.w3.org/2001/XMLSchema#unsignedInt datatype IRI.
- http://www.w3.org/2001/XMLSchema#unsignedLong datatype IRI.
- http://www.w3.org/2001/XMLSchema#unsignedShort datatype IRI.
- http://www.w3.org/2001/XMLSchema#yearMonthDuration datatype IRI.
Traits§
- Parse a value directly from its XSD lexical form.
Type Aliases§
- XSD lexical parse result.