Crates.io | oxsdatatypes |
lib.rs | oxsdatatypes |
version | 0.2.2 |
created_at | 2023-01-18 19:49:28.386168+00 |
updated_at | 2025-01-11 20:14:57.611679+00 |
description | An implementation of some XSD datatypes for SPARQL implementations |
homepage | |
repository | https://github.com/oxigraph/oxigraph/tree/main/lib/oxsdatatypes |
max_upload_size | |
id | 761990 |
size | 227,653 |
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
, and Eq
if possible, implementations following its equality relation.
PartialOrd
, and Ord
if possible, implementations following its order relation.
From
and TryFrom
implementations to implement XPath casting.
Various methods implementing XPath functions.
from_be_bytes
and to_be_bytes
methods for serialization.
DateTime::now
behaviorThe DateTime::now()
function needs special OS support.
Currently:
custom-now
feature is enabled, a function computing now
must be set:
use oxsdatatypes::Duration;
#[no_mangle]
fn custom_ox_now() -> Duration {
unimplemented!("now implementation")
}
wasm32-unknown-unknown
if the js
feature is enabled the Date.now()
ECMAScript API is used.zkvm
there is no access to IO functions so the function returns start of unix time (Jan 1, 1970)SystemTime::now()
is used.This project is licensed under either of
<http://www.apache.org/licenses/LICENSE-2.0>
)<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.