[−][src]Struct xml::namespace::NamespaceStack
Namespace stack is a sequence of namespaces.
Namespace stack is used to represent cumulative namespace consisting of combined namespaces from nested elements.
Methods
impl NamespaceStack
[src]
pub fn empty() -> NamespaceStack
[src]
Returns an empty namespace stack.
pub fn default() -> NamespaceStack
[src]
Returns a namespace stack with default items in it.
Default items are the following:
xml
→http://www.w3.org/XML/1998/namespace
;xmlns
→http://www.w3.org/2000/xmlns/
.
pub fn push_empty(&mut self) -> &mut NamespaceStack
[src]
Adds an empty namespace to the top of this stack.
pub fn pop(&mut self) -> Namespace
[src]
Removes the topmost namespace in this stack.
Panics if the stack is empty.
pub fn try_pop(&mut self) -> Option<Namespace>
[src]
Removes the topmost namespace in this stack.
Returns Some(namespace)
if this stack is not empty and None
otherwise.
pub fn peek_mut(&mut self) -> &mut Namespace
[src]
Borrows the topmost namespace mutably, leaving the stack intact.
Panics if the stack is empty.
pub fn peek(&self) -> &Namespace
[src]
Borrows the topmost namespace immutably, leaving the stack intact.
Panics if the stack is empty.
pub fn put_checked<P, U>(&mut self, prefix: P, uri: U) -> bool where
P: Into<String> + AsRef<str>,
U: Into<String> + AsRef<str>,
[src]
P: Into<String> + AsRef<str>,
U: Into<String> + AsRef<str>,
Puts a mapping into the topmost namespace if this stack does not already contain one.
Returns a boolean flag indicating whether the insertion has completed successfully. Note that both key and value are matched and the mapping is inserted if either namespace prefix is not already mapped, or if it is mapped, but to a different URI.
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 stack.
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 the topmost namespace in this stack.
This method does not override a mapping in the topmost namespace if it is already present, however, it does not depend on other namespaces in the stack, so it is possible to put a mapping which is present in lower namespaces.
Returns a boolean flag indicating whether the insertion has completed successfully.
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 get<'a, P: ?Sized + AsRef<str>>(&'a self, prefix: &P) -> Option<&'a str>
[src]
Performs a search for the given prefix in the whole stack.
This method walks the stack from top to bottom, querying each namespace
in order for the given prefix. If none of the namespaces contains the prefix,
None
is returned.
Parameters
prefix
--- namespace prefix.
pub fn squash(&self) -> Namespace
[src]
Combines this stack of namespaces into a single namespace.
Namespaces are combined in left-to-right order, that is, rightmost namespace elements take priority over leftmost ones.
pub fn checked_target(&mut self) -> CheckedTarget
[src]
Returns an object which implements Extend
using put_checked()
instead of put()
.
See CheckedTarget
for more information.
ⓘImportant traits for NamespaceStackMappings<'a>pub fn iter(&self) -> NamespaceStackMappings
[src]
Returns an iterator over all mappings in this namespace stack.
Trait Implementations
impl Eq for NamespaceStack
[src]
impl Clone for NamespaceStack
[src]
fn clone(&self) -> NamespaceStack
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Extend<(&'a str, &'a str)> for NamespaceStack
[src]
fn extend<T>(&mut self, iterable: T) where
T: IntoIterator<Item = UriMapping<'a>>,
[src]
T: IntoIterator<Item = UriMapping<'a>>,
impl PartialEq<NamespaceStack> for NamespaceStack
[src]
fn eq(&self, other: &NamespaceStack) -> bool
[src]
fn ne(&self, other: &NamespaceStack) -> bool
[src]
impl<'a> IntoIterator for &'a NamespaceStack
[src]
type Item = UriMapping<'a>
The type of the elements being iterated over.
type IntoIter = NamespaceStackMappings<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl Debug for NamespaceStack
[src]
Auto Trait Implementations
impl Send for NamespaceStack
impl Unpin for NamespaceStack
impl Sync for NamespaceStack
impl UnwindSafe for NamespaceStack
impl RefUnwindSafe for NamespaceStack
Blanket Implementations
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> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for 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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,