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:
FromStrimplementation to parse a datatype string serialization following its lexical mapping.Displayimplementation to serialize a datatype following its canonical mapping.is_identical_withmethod following its identity relation.PartialEq, andEqif possible, implementations following its equality relation.PartialOrd, andOrdif possible, implementations following its order relation.FromandTryFromimplementations to implement XPath casting.- Various methods implementing XPath functions.
from_be_bytesandto_be_bytesmethods for serialization.
The DateTime::now() function needs special OS support.
Currently:
- If the
custom-nowfeature is enabled, a function computingnowmust be set:use oxsdatatypes::Duration; #[unsafe(no_mangle)] fn custom_ox_now() -> Duration { unimplemented!("now implementation") }
- For
wasm32-unknown-unknownif thejsfeature is enabled theDate.now()ECMAScript API is used. - For
zkvmthere 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.
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.
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.