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 DateTimedatatype variants.- Date
Time Value - Any specialized
DateTimevalue. - Decimal
Datatype Decimaldatatype variants.- Decimal
Value - Any specialized
Decimalvalue. - Decimal
Value Ref - Any specialized
Decimalvalue reference. - Duration
Datatype Durationdatatype variants.- Duration
Value - Any specialized
Durationvalue. - IntDatatype
Intdatatype variants.- IntValue
- Any specialized
Intvalue. - Integer
Datatype Integerdatatype variants.- Integer
Value - Any specialized
Integervalue. - Integer
Value Ref - Any specialized
Integervalue reference. - Long
Datatype Longdatatype variants.- Long
Value - Any specialized
Longvalue. - NCName
Datatype NCNamedatatype variants.- NCName
Value - Any specialized
NCNamevalue. - NCName
Value Ref - Any specialized
NCNamevalue reference. - Name
Datatype Namedatatype variants.- Name
Value - Any specialized
Namevalue. - Name
Value Ref - Any specialized
Namevalue reference. - NonNegative
Integer Datatype NonNegativeIntegerdatatype variants.- NonNegative
Integer Value - Any specialized
NonNegativeIntegervalue. - NonNegative
Integer Value Ref - Any specialized
NonNegativeIntegervalue reference. - NonPositive
Integer Datatype NonPositiveIntegerdatatype variants.- NonPositive
Integer Value - Any specialized
NonPositiveIntegervalue. - NonPositive
Integer Value Ref - Any specialized
NonPositiveIntegervalue reference. - Normalized
String Datatype NormalizedStrdatatype variants.- Normalized
String Value - Any specialized
NormalizedStrvalue. - Normalized
String Value Ref - Any specialized
NormalizedStrvalue reference. - Parse
XsdError - XSD lexical parse error.
- Primitive
Datatype - XSD primitive datatype.
- Short
Datatype Shortdatatype variants.- Short
Value - Any specialized
Shortvalue. - String
Datatype strdatatype variants.- String
Value - Any specialized
strvalue. - String
Value Ref - Any specialized
strvalue reference. - Token
Datatype Tokendatatype variants.- Token
Value - Any specialized
Tokenvalue. - Token
Value Ref - Any specialized
Tokenvalue reference. - Unsigned
IntDatatype UnsignedIntdatatype variants.- Unsigned
IntValue - Any specialized
UnsignedIntvalue. - Unsigned
Long Datatype UnsignedLongdatatype variants.- Unsigned
Long Value - Any specialized
UnsignedLongvalue. - Unsigned
Short Datatype UnsignedShortdatatype variants.- Unsigned
Short Value - Any specialized
UnsignedShortvalue. - 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.