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§
Structs§
- Parse
Error - XSD value parse error.
Enums§
- Datatype
- XSD datatype (primitive or not).
- Date
Time Datatype DateTime
datatype variants.- Date
Time Value - Any specialized
DateTime
value. - Decimal
Datatype Decimal
datatype variants.- Decimal
Value - Any specialized
Decimal
value. - Decimal
Value Ref - Any specialized
Decimal
value reference. - Duration
Datatype Duration
datatype variants.- Duration
Value - Any specialized
Duration
value. - IntDatatype
Int
datatype variants.- IntValue
- Any specialized
Int
value. - Integer
Datatype Integer
datatype variants.- Integer
Value - Any specialized
Integer
value. - Integer
Value Ref - Any specialized
Integer
value reference. - Long
Datatype Long
datatype variants.- Long
Value - Any specialized
Long
value. - NCName
Datatype NCName
datatype variants.- NCName
Value - Any specialized
NCName
value. - NCName
Value Ref - Any specialized
NCName
value reference. - Name
Datatype Name
datatype variants.- Name
Value - Any specialized
Name
value. - Name
Value Ref - Any specialized
Name
value reference. - NonNegative
Integer Datatype NonNegativeInteger
datatype variants.- NonNegative
Integer Value - Any specialized
NonNegativeInteger
value. - NonNegative
Integer Value Ref - Any specialized
NonNegativeInteger
value reference. - NonPositive
Integer Datatype NonPositiveInteger
datatype variants.- NonPositive
Integer Value - Any specialized
NonPositiveInteger
value. - NonPositive
Integer Value Ref - Any specialized
NonPositiveInteger
value reference. - Normalized
String Datatype NormalizedStr
datatype variants.- Normalized
String Value - Any specialized
NormalizedStr
value. - Normalized
String Value Ref - Any specialized
NormalizedStr
value reference. - Parse
XsdError - XSD lexical parse error.
- Primitive
Datatype - XSD primitive datatype.
- Short
Datatype Short
datatype variants.- Short
Value - Any specialized
Short
value. - String
Datatype str
datatype variants.- String
Value - Any specialized
str
value. - String
Value Ref - Any specialized
str
value reference. - Token
Datatype Token
datatype variants.- Token
Value - Any specialized
Token
value. - Token
Value Ref - Any specialized
Token
value reference. - Unsigned
IntDatatype UnsignedInt
datatype variants.- Unsigned
IntValue - Any specialized
UnsignedInt
value. - Unsigned
Long Datatype UnsignedLong
datatype variants.- Unsigned
Long Value - Any specialized
UnsignedLong
value. - Unsigned
Short Datatype UnsignedShort
datatype variants.- Unsigned
Short Value - Any specialized
UnsignedShort
value. - Value
- Any XSD value.
- Value
Ref - Any XSD value reference.
Constants§
- XSD_
ANY_ URI - http://www.w3.org/2001/XMLSchema#anyURI datatype IRI.
- XSD_
BASE64_ BINARY - http://www.w3.org/2001/XMLSchema#base64Binary datatype IRI.
- XSD_
BOOLEAN - http://www.w3.org/2001/XMLSchema#boolean datatype IRI.
- XSD_
BYTE - http://www.w3.org/2001/XMLSchema#byte datatype IRI.
- XSD_
DATE - http://www.w3.org/2001/XMLSchema#date datatype IRI.
- XSD_
DATE_ TIME - http://www.w3.org/2001/XMLSchema#dateTime datatype IRI.
- XSD_
DATE_ TIME_ STAMP - http://www.w3.org/2001/XMLSchema#dateTimeStamp datatype IRI.
- XSD_
DAY_ TIME_ DURATION - http://www.w3.org/2001/XMLSchema#dayTimeDuration datatype IRI.
- XSD_
DECIMAL - http://www.w3.org/2001/XMLSchema#decimal datatype IRI.
- XSD_
DOUBLE - http://www.w3.org/2001/XMLSchema#double datatype IRI.
- XSD_
DURATION - http://www.w3.org/2001/XMLSchema#duration datatype IRI.
- XSD_
ENTITIES - http://www.w3.org/2001/XMLSchema#ENTITIES datatype IRI.
- XSD_
ENTITY - http://www.w3.org/2001/XMLSchema#ENTITY datatype IRI.
- XSD_
FLOAT - http://www.w3.org/2001/XMLSchema#float datatype IRI.
- XSD_
G_ DAY - http://www.w3.org/2001/XMLSchema#gDay datatype IRI.
- XSD_
G_ MONTH - http://www.w3.org/2001/XMLSchema#gMonth datatype IRI.
- XSD_
G_ MONTH_ DAY - http://www.w3.org/2001/XMLSchema#gMonthDay datatype IRI.
- XSD_
G_ YEAR - http://www.w3.org/2001/XMLSchema#gYear datatype IRI.
- XSD_
G_ YEAR_ MONTH - http://www.w3.org/2001/XMLSchema#gYearMonth datatype IRI.
- XSD_
HEX_ BINARY - http://www.w3.org/2001/XMLSchema#hexBinary datatype IRI.
- XSD_ID
- http://www.w3.org/2001/XMLSchema#ID datatype IRI.
- XSD_
IDREF - http://www.w3.org/2001/XMLSchema#IDREF datatype IRI.
- XSD_
IDREFS - http://www.w3.org/2001/XMLSchema#IDREFS datatype IRI.
- XSD_INT
- http://www.w3.org/2001/XMLSchema#int datatype IRI.
- XSD_
INTEGER - http://www.w3.org/2001/XMLSchema#integer datatype IRI.
- XSD_
LANGUAGE - http://www.w3.org/2001/XMLSchema#language datatype IRI.
- XSD_
LONG - http://www.w3.org/2001/XMLSchema#long datatype IRI.
- XSD_
NAME - http://www.w3.org/2001/XMLSchema#Name datatype IRI.
- XSD_
NC_ NAME - http://www.w3.org/2001/XMLSchema#NCName datatype IRI.
- XSD_
NEGATIVE_ INTEGER - http://www.w3.org/2001/XMLSchema#negativeInteger datatype IRI.
- XSD_
NMTOKEN - http://www.w3.org/2001/XMLSchema#NMTOKEN datatype IRI.
- XSD_
NMTOKENS - http://www.w3.org/2001/XMLSchema#NMTOKENS datatype IRI.
- XSD_
NON_ NEGATIVE_ INTEGER - http://www.w3.org/2001/XMLSchema#nonNegativeInteger datatype IRI.
- XSD_
NON_ POSITIVE_ INTEGER - http://www.w3.org/2001/XMLSchema#nonPositiveInteger datatype IRI.
- XSD_
NORMALIZED_ STRING - http://www.w3.org/2001/XMLSchema#normalizedString datatype IRI.
- XSD_
NOTATION - http://www.w3.org/2001/XMLSchema#NOTATION datatype IRI.
- XSD_
POSITIVE_ INTEGER - http://www.w3.org/2001/XMLSchema#positiveInteger datatype IRI.
- XSD_
Q_ NAME - http://www.w3.org/2001/XMLSchema#QName datatype IRI.
- XSD_
SHORT - http://www.w3.org/2001/XMLSchema#short datatype IRI.
- XSD_
STRING - http://www.w3.org/2001/XMLSchema#string datatype IRI.
- XSD_
TIME - http://www.w3.org/2001/XMLSchema#time datatype IRI.
- XSD_
TOKEN - http://www.w3.org/2001/XMLSchema#token datatype IRI.
- XSD_
UNSIGNED_ BYTE - http://www.w3.org/2001/XMLSchema#unsignedByte datatype IRI.
- XSD_
UNSIGNED_ INT - http://www.w3.org/2001/XMLSchema#unsignedInt datatype IRI.
- XSD_
UNSIGNED_ LONG - http://www.w3.org/2001/XMLSchema#unsignedLong datatype IRI.
- XSD_
UNSIGNED_ SHORT - http://www.w3.org/2001/XMLSchema#unsignedShort datatype IRI.
- XSD_
YEAR_ MONTH_ DURATION - http://www.w3.org/2001/XMLSchema#yearMonthDuration datatype IRI.
Traits§
- Parse
Xsd - Parse a value directly from its XSD lexical form.
Type Aliases§
- Parse
XsdResult - XSD lexical parse result.