[−][src]Struct xml::namespace::Namespace
Namespace is a map from prefixes to namespace URIs.
No prefix (i.e. default namespace) is designated by NS_NO_PREFIX constant.
Methods
impl Namespace[src]
pub fn empty() -> Namespace[src]
Returns an empty namespace.
pub fn is_empty(&self) -> bool[src]
Checks whether this namespace is empty.
pub fn is_essentially_empty(&self) -> bool[src]
Checks whether this namespace is essentially empty, that is, it does not contain anything but default mappings.
pub fn contains<P: ?Sized + AsRef<str>>(&self, prefix: &P) -> bool[src]
Checks whether this namespace mapping contains the given prefix.
Parameters
prefix--- namespace prefix.
Return value
true if this namespace contains the given prefix, false otherwise.
pub fn put<P, U>(&mut self, prefix: P, uri: U) -> bool where
P: Into<String>,
U: Into<String>, [src]
P: Into<String>,
U: Into<String>,
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.
pub fn force_put<P, U>(&mut self, prefix: P, uri: U) -> Option<String> where
P: Into<String>,
U: Into<String>, [src]
P: Into<String>,
U: Into<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.
pub fn get<'a, P: ?Sized + AsRef<str>>(&'a self, prefix: &P) -> Option<&'a str>[src]
Queries the namespace for the given prefix.
Parameters
prefix--- namespace prefix.
Return value
Namespace URI corresponding to the given prefix, if it is present.
Trait Implementations
impl<'a> Extend<(&'a str, &'a str)> for Namespace[src]
fn extend<T>(&mut self, iterable: T) where
T: IntoIterator<Item = UriMapping<'a>>, [src]
T: IntoIterator<Item = UriMapping<'a>>,
impl<'a> IntoIterator for &'a Namespace[src]
type Item = UriMapping<'a>
The type of the elements being iterated over.
type IntoIter = NamespaceMappings<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter[src]
impl Clone for Namespace[src]
impl Eq for Namespace[src]
impl PartialEq<Namespace> for Namespace[src]
impl Debug for Namespace[src]
impl StructuralPartialEq for Namespace[src]
impl StructuralEq for Namespace[src]
Auto Trait Implementations
impl Send for Namespace
impl Sync for Namespace
impl Unpin for Namespace
impl UnwindSafe for Namespace
impl RefUnwindSafe for Namespace
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,