pub struct Namespace(pub BTreeMap<String, String>);
Expand description
Namespace is a map from prefixes to namespace URIs.
No prefix (i.e. default namespace) is designated by NS_NO_PREFIX
constant.
Tuple Fields§
§0: BTreeMap<String, String>
Implementations§
Source§impl Namespace
impl Namespace
Sourcepub fn is_essentially_empty(&self) -> bool
pub fn is_essentially_empty(&self) -> bool
Checks whether this namespace is essentially empty, that is, it does not contain anything but default mappings.
Sourcepub fn put<P, U>(&mut self, prefix: P, uri: U) -> bool
pub fn put<P, U>(&mut self, prefix: P, uri: U) -> bool
Puts a mapping into this namespace.
This method does not override any already existing mappings.
Returns a boolean flag indicating whether the map already contained the given prefix.
§Parameters
prefix
— namespace prefix;uri
— namespace URI.
§Return value
true
if prefix
has been inserted successfully; false
if the prefix
was already present in the namespace.
Sourcepub fn force_put<P, U>(&mut self, prefix: P, uri: U) -> Option<String>
pub fn force_put<P, U>(&mut self, prefix: P, uri: U) -> Option<String>
Puts a mapping into this namespace forcefully.
This method, unlike put()
, does replace an already existing mapping.
Returns previous URI which was assigned to the given prefix, if it is present.
§Parameters
prefix
— namespace prefix;uri
— namespace URI.
§Return value
Some(uri)
with uri
being a previous URI assigned to the prefix
, or
None
if such prefix was not present in the namespace before.
Sourcepub fn iter(&self) -> NamespaceMappings<'_>
pub fn iter(&self) -> NamespaceMappings<'_>
Namespace mappings contained in a namespace.
Trait Implementations§
Source§impl<'a> Extend<(&'a str, &'a str)> for Namespace
impl<'a> Extend<(&'a str, &'a str)> for Namespace
Source§fn extend<T>(&mut self, iterable: T)where
T: IntoIterator<Item = UriMapping<'a>>,
fn extend<T>(&mut self, iterable: T)where
T: IntoIterator<Item = UriMapping<'a>>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl<'a> IntoIterator for &'a Namespace
impl<'a> IntoIterator for &'a Namespace
impl Eq for Namespace
impl StructuralPartialEq for Namespace
Auto Trait Implementations§
impl Freeze for Namespace
impl RefUnwindSafe for Namespace
impl Send for Namespace
impl Sync for Namespace
impl Unpin for Namespace
impl UnwindSafe for Namespace
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)