Expand description
§oxsdatatypes
oxsdatatypes is an implementation of some XML Schema Definition Language Datatypes. Its main aim is to ease the implementation of SPARQL and XPath.
Usage example:
use std::str::FromStr;
use oxsdatatypes::Decimal;
assert!(Decimal::from_str("22.2").unwrap() > Decimal::from_str("21").unwrap());
Each datatype is represented by a Rust struct.
Each datatype provides:
FromStr
implementation to parse a datatype string serialization following its lexical mapping.Display
implementation to serialize a datatype following its canonical mapping.is_identical_with
method following its identity relation.PartialEq
, andEq
if possible, implementations following its equality relation.PartialOrd
, andOrd
if possible, implementations following its order relation.From
andTryFrom
implementations to implement XPath casting.- Various methods implementing XPath functions.
from_be_bytes
andto_be_bytes
methods for serialization.
§DateTime::now
behavior
The DateTime::now()
function needs special OS support.
Currently:
- If the
custom-now
feature is enabled, a function computingnow
must be set:use oxsdatatypes::Duration; #[no_mangle] fn custom_ox_now() -> Duration { unimplemented!("now implementation") }
- For
wasm32-unknown-unknown
if thejs
feature is enabled theDate.now()
ECMAScript API is used. - For
zkvm
there is no access to IO functions so the function returns start of unix time (Jan 1, 1970) - For all other targets
SystemTime::now()
is used.
§License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or
<http://www.apache.org/licenses/LICENSE-2.0>
) - MIT license (LICENSE-MIT or
<http://opensource.org/licenses/MIT>
)
at your option.
§Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Oxigraph by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Structs§
- Boolean
- XML Schema
boolean
datatype - Date
- XML Schema
date
datatype - Date
Time - XML Schema
dateTime
datatype - Date
Time Overflow Error - An overflow during
DateTime
-related operations. - DayTime
Duration - XML Schema
dayTimeDuration
datatype - Decimal
- XML Schema
decimal
datatype - Double
- XML Schema
double
datatype - Duration
- XML Schema
duration
datatype - Duration
Overflow Error - An overflow during
Duration
-related operations. - Float
- XML Schema
float
datatype - GDay
- XML Schema
date
datatype - GMonth
- XML Schema
gMonth
datatype - GMonth
Day - XML Schema
gMonthDay
datatype - GYear
- XML Schema
gYear
datatype - GYear
Month - XML Schema
gYearMonth
datatype - Integer
- XML Schema
integer
datatype - Invalid
Timezone Error - The value provided as timezone is not valid.
- Opposite
Sign InDuration Components Error - The year-month and the day-time components of a
Duration
have an opposite sign. - Parse
Date Time Error - A parsing error
- Parse
Decimal Error - An error when parsing a
Decimal
. - Parse
Duration Error - A parsing error
- Time
- XML Schema
time
datatype - Timezone
Offset - A timezone offset with respect to UTC.
- TooLarge
ForDecimal Error - The input is too large to fit into a
Decimal
. - TooLarge
ForInteger Error - The input is too large to fit into an
Integer
. - Year
Month Duration - XML Schema
yearMonthDuration
datatype