Crates.io | rdftk_iri |
lib.rs | rdftk_iri |
version | 0.2.5 |
source | src |
created_at | 2020-07-28 17:36:27.781578 |
updated_at | 2024-10-08 01:04:28.479174 |
description | This crate provides an implementation of the IRI and URI specifications. |
homepage | |
repository | https://github.com/johnstonskj/rust-rdftk.git |
max_upload_size | |
id | 270554 |
size | 39,434 |
This crate provides an implementation of the IRI
and URI
specifications.
As with the rest of the RDFtk project the aim of this crate is usability over
optimization, and so it may perform more clones than necessary and parse more
slowly than could be the case. For the most part clients should use the IriRef
type that is an Arc
reference and so can be reused without cloning the whole Iri
value.
The most common use is the parsing of an IRI
value from a string.
use rdftk_iri::{Iri, IriExtra as _};
use std::str::FromStr;
let namespace = Iri::from_str(
"https://example.org/ns/things#",
).unwrap();
assert!(namespace.looks_like_namespace());
let name = namespace.make_name("ThisThing").unwrap();
assert_eq!(
name.to_string(),
"https://example.org/ns/things#ThisThing".to_string(),
);
assert_eq!(
name.namespace(),
Some(namespace),
);
assert_eq!(
name.name(),
Some("ThisThing".to_string()),
);
From<QName
and From<&QName>
for String
.QName
type into this package from core.From<&Name>
for String
.Name
structure (and NameParseError
) to validate the name
component of an IRI representing a namespaced-name.
NameParser
to encapsulate different name rules.NameParseError
for errors generated by name parsers.IriExtra::split
and IriExtra::name
.IriExtra::make_name
.url
crate.
IriExtra
to provide new methods to the url::Url
type.IriExtra
.README.md
.IRI
implement PartialOrd
+ Ord
, it can now be sorted.PercentEncoding
trait for percent encoding components.UserInfo::to_string
.IpvFuture::from_str
.host
, path_root
, path
methods to IriBuilder
.with_new_query
and with_new_fragment
on IRI
to not take
Option
.blob
known value to Scheme
.IRI
examples.Scheme
, will add for more.IRI::is_absolute
, to ignore authority and take the fragment into
account.IRI::is_relative_reference
.path_iri
and uuid_iri
features.IRIRef
type.