sophia_api::prefix

Trait PrefixMap

Source
pub trait PrefixMap {
    // Required methods
    fn get_namespace<'s>(&'s self, prefix: &str) -> Option<Iri<&'s str>>;
    fn get_checked_prefixed_pair<'s, T, F>(
        &'s self,
        iri: T,
        suffix_check: F,
    ) -> Option<(Prefix<&'s str>, MownStr<'s>)>
       where T: IsIri + 's,
             F: Fn(&str) -> bool;
    fn iter<'s>(
        &'s self,
    ) -> Box<dyn Iterator<Item = (Prefix<&'s str>, Iri<&'s str>)> + 's>;

    // Provided methods
    fn get_prefixed_pair<'s, T: IsIri + 's>(
        &'s self,
        iri: T,
    ) -> Option<(Prefix<&'s str>, MownStr<'s>)> { ... }
    fn to_vec(&self) -> Vec<PrefixMapPair> { ... }
}
Expand description

A prefix map associates prefixes to namespaces.

Required Methods§

Source

fn get_namespace<'s>(&'s self, prefix: &str) -> Option<Iri<&'s str>>

Return the IRI associated to this prefix, if any.

Source

fn get_checked_prefixed_pair<'s, T, F>( &'s self, iri: T, suffix_check: F, ) -> Option<(Prefix<&'s str>, MownStr<'s>)>
where T: IsIri + 's, F: Fn(&str) -> bool,

Return a prefix-suffix pair describing the given IRI, if any, guaranteeing that the suffix will satisfy the given predicate.

Source

fn iter<'s>( &'s self, ) -> Box<dyn Iterator<Item = (Prefix<&'s str>, Iri<&'s str>)> + 's>

Iterate over (prefix, IRI) pairs.

Provided Methods§

Source

fn get_prefixed_pair<'s, T: IsIri + 's>( &'s self, iri: T, ) -> Option<(Prefix<&'s str>, MownStr<'s>)>

Return a prefix-suffix pair describing the given IRI, if any.

Source

fn to_vec(&self) -> Vec<PrefixMapPair>

Copies this prefix map as a self-sufficient vector

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<P, N> PrefixMap for [(P, N)]
where P: IsPrefix, N: IsIri,

Source§

fn get_namespace<'s>(&'s self, prefix: &str) -> Option<Iri<&'s str>>

Source§

fn get_checked_prefixed_pair<'s, T, F>( &'s self, iri: T, suffix_check: F, ) -> Option<(Prefix<&'s str>, MownStr<'s>)>
where T: IsIri + 's, F: Fn(&str) -> bool,

Source§

fn iter<'s>( &'s self, ) -> Box<dyn Iterator<Item = (Prefix<&'s str>, Iri<&'s str>)> + 's>

Implementors§