pub struct NamespaceStore { /* private fields */ }
Expand description
Storage for multiple namespaces.
Implementations§
Source§impl NamespaceStore
impl NamespaceStore
Sourcepub fn new() -> NamespaceStore
pub fn new() -> NamespaceStore
Constructor for NamespaceStore
.
§Examples
use rdf::namespace::NamespaceStore;
let nss = NamespaceStore::new();
Sourcepub fn namespaces(&self) -> &HashMap<String, Uri>
pub fn namespaces(&self) -> &HashMap<String, Uri>
Returns the stored namespaces with prefixes.
Sourcepub fn add(&mut self, ns: &Namespace)
pub fn add(&mut self, ns: &Namespace)
Adds a new namespace.
§Examples
use rdf::namespace::NamespaceStore;
use rdf::namespace::Namespace;
use rdf::uri::Uri;
let mut nss = NamespaceStore::new();
let ns = Namespace::new("example".to_string(),
Uri::new("http://example.org/".to_string()));
nss.add(&ns);
Sourcepub fn get_uri_by_prefix(&self, prefix: &str) -> Result<&Uri>
pub fn get_uri_by_prefix(&self, prefix: &str) -> Result<&Uri>
Returns the URI of a specific namespace.
§Examples
use rdf::namespace::NamespaceStore;
use rdf::namespace::Namespace;
use rdf::uri::Uri;
let mut nss = NamespaceStore::new();
let ns = Namespace::new("example".to_string(),
Uri::new("http://example.org/".to_string()));
nss.add(&ns);
assert_eq!(nss.get_uri_by_prefix("example").unwrap(),
&Uri::new("http://example.org/".to_string()))
Trait Implementations§
Source§impl Debug for NamespaceStore
impl Debug for NamespaceStore
Source§impl Default for NamespaceStore
impl Default for NamespaceStore
Source§fn default() -> NamespaceStore
fn default() -> NamespaceStore
Returns the “default value” for a type. Read more
Source§impl PartialEq for NamespaceStore
impl PartialEq for NamespaceStore
impl StructuralPartialEq for NamespaceStore
Auto Trait Implementations§
impl Freeze for NamespaceStore
impl RefUnwindSafe for NamespaceStore
impl Send for NamespaceStore
impl Sync for NamespaceStore
impl Unpin for NamespaceStore
impl UnwindSafe for NamespaceStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more