Crates.io | field33_rdftk_iri_temporary_fork |
lib.rs | field33_rdftk_iri_temporary_fork |
version | 0.1.9 |
source | src |
created_at | 2022-08-23 09:14:14.24382 |
updated_at | 2022-08-23 09:14:14.24382 |
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 | 650877 |
size | 331,977 |
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 field33_rdftk_iri_temporary_fork::IRI;
use std::convert::from_str;
let result = IRI::from_str(
"https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top",
);
The builder
module allows for more programmatic construction of IRI
s.
use field33_rdftk_iri_temporary_fork::{IRI, Scheme};
use field33_rdftk_iri_temporary_fork::builder::IriBuilder;
let mut builder = IriBuilder::default();
let result: IriResult<IRI> = builder
.scheme(&Scheme::https())
.user_name("john.doe")
.host("www.example.com")?
.port(123.into())
.path_str("/forum/questions/")?
.query_str("tag=networking&order=newest")?
.fragment_str("top")?
.try_into();
Note also the use of Scheme::https()
, both the Scheme
and Port
types include associated functions
to construct well-known values.
The following features are present in this crate.
builder
[default] -- include the builder
module, which in turn includes the IriBuilder
type.genid
[default] -- includes a constructor to create "genid"
well-known IRI values.path_iri
[default] -- provides an implementation of TryFrom<&PathBuf>
and TryFrom<PathBuf>
for IRI
.uuid_iri
[default] -- provides an implementation of TryFrom<&Uuid>
and TryFrom<Uuid>
for IRI
.Version 0.1.9
Version 0.1.8
Version 0.1.7
Version 0.1.6
Version 0.1.5
Version 0.1.4
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
.Version 0.1.3
IRI
examples.Scheme
, will add for more.IRI::is_absolute
, to ignore authority and take the fragment into account.IRI::is_relative_reference
.Version 0.1.2
path_iri
and uuid_iri
features.Version 0.1.1
IRIRef
type.Version 0.1.0