Expand description
This crate provides functions for validating IRIs and IRI references, as well as for resolving IRI references against a given base IRI.
It is developed as a part of Sophia, an RDF and Linked Data toolkit in Rust, but can be used independently.
§Feature gates
-
test_dataexposes thetestmodule, which contains arrays of good and bad IRIs, useful for testing purposes, possibly in other crates. -
examples exposes the
wrap_macro_examplesmodule, whose role is to exemplify the effect of thewrapmacro. -
uri exposes similar traits and types for dealing with URIs (RFC 3986), which are basically the subset of IRIs using only ASCII characters.
Modules§
- relativize
- Implement relativization of an IRI against a base IRI.
- resolve
- Implementation of IRI resolution as per [RFC 3987].
- test
- Test module for
sophia_iri. - uri
- Traits and types to handle URIs (RFC 3986).
- wrap_
macro_ examples - This module provides examples of what the
wrapmacro generates.
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§
- Invalid
Iri - This error is raised when trying to parse an invalid IRI.
- Iri
- See
Iri::new. - IriRef
- See
IriRef::new.
Statics§
- IRELATIVE_
REF_ REGEX_ SRC - Match a relative IRI reference.
- IRI_
REGEX_ SRC - Match an absolute IRI reference.
Traits§
- AsIri
- Automatic trait for
IsIri, providing cheap conversion toIri. - AsIri
Ref - Automatic trait for
IsIriRef, providing cheap conversion toIriRef. - IsIri
- Marker trait guaranteeing that the underlying
stris a valid IRI-reference (i.e. absolute, with an optional fragment identifier) - IsIri
Ref - Marker trait guaranteeing that the underlying
stris a valid IRI (i.e. absolute or relative, with an optional fragment identifier)
Functions§
- is_
absolute_ iri_ ref - Check whether
txtis an absolute IRI reference. - is_
relative_ iri_ ref - Check whether
txtis a relative IRI reference. - is_
valid_ iri_ ref - Check whether
txtis a valid (absolute or relative) IRI reference. - is_
valid_ suffixed_ iri_ ref - Check whether
nsandsuffixconcatenate into a valid (absolute or relative) IRI reference.
Type Aliases§
- Result
- Type alias for
Resultwith default errorInvalidIri.