Crate sophia_iri

Source
Expand description

This crate provides functions for validating IRIs and IRI references, as well as for resolving IRI references agains a given base IRI.

It is developed as a part of Sophia, an RDF and Linked Data toolkit in Rust, but can be used independantly.

§Feature gates

  • test_data exposes the test module, which contains arrays of good and bad IRIs, useful for testing purposes, possibly in other crates.

  • examples exposes the [wrap_macro_examples] module, whose role is to exemplify the effect of the wrap macro.

Modules§

resolve
Implementation of IRI resolution as per [RFC 3987].

Macros§

wrap
This macro is used to create a read-only wrapper around a type T, usually for the purpose of guaranteeing that the wrapped value verifies some condition. This macro takes care of defining all the usual traits for the wrapper type.

Structs§

InvalidIri
This error is raised when trying to parse an invalid IRI.
Iri
See Iri::new.
IriRef
See IriRef::new.

Traits§

AsIri
Automatic trait for IsIri, providing cheap conversion to Iri.
AsIriRef
Automatic trait for IsIriRef, providing cheap conversion to IriRef.
IsIri
Marker trait guaranteeing that the underlying str is a valid IRI-reference (i.e. absolute, with an optional fragment identifier)
IsIriRef
Marker trait guaranteeing that the underlying str is a valid IRI (i.e. absolute or relative, with an optional fragment identifier)

Functions§

is_absolute_iri_ref
Check whether txt is an absolute IRI reference.
is_relative_iri_ref
Check whether txt is a relative IRI reference.
is_valid_iri_ref
Check whether txt is a valid (absolute or relative) IRI reference.
is_valid_suffixed_iri_ref
Check whether ns and suffix concatenate into a valid (absolute or relative) IRI reference.

Type Aliases§

Result
Type alias for Result with default error TermError.