ekg_identifier/iri/namespace_iri.rs
1pub trait NamespaceIRI {
2 /// Returns the namespace IRI as a string slice
3 fn as_str(&self) -> &str;
4 /// Returns the length in characters of the namespace IRI
5 fn len(&self) -> usize { self.as_str().len() }
6 /// Returns whether the namespace IRI is empty.
7 fn is_empty(&self) -> bool { self.as_str().is_empty() }
8 /// Returns true if the given IRI is in the namespace
9 fn is_in_namespace(&self, iri: &str) -> bool { iri.starts_with(self.as_str()) }
10
11 /// Returns the authority part of the namespace IRI, if any (and if it's not
12 /// `localhost` or `127.0.0.1`)
13 fn authority(&self) -> Option<&str> { None }
14}