rdftk_iri 0.1.2

Another implementation of the IRI/URI specifications
Documentation

RDFtk: IRI

Another implementation of the IRI and URI specifications.

crates.io docs.rs

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.

Example

The most common use is the parsing of an IRI value from a string.

use rdftk_iri::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 IRIs.

use rdftk_iri::{IRI, Scheme};
use rdftk_iri::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.

Features

The following features are present in this crate.

  • builder [default] -- include the builder module, which in turn includes the IriBuilder type.
  • 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.

Changes

Version 0.1.2

  • Mostly documentation additions.
  • Adding test cases where possible.
  • Added helper functions and API shortcuts where they make sense.
  • Added path_iri and uuid_iri features.

Version 0.1.1

  • Added IRIRef type.

Version 0.1.0

  • First release.

TODO

  1. Complete IRI normalization
  2. Complete IRI resolver
  3. Complete IRI relativizer

RDF