Struct xml::namespace::Namespace
[−]
[src]
pub struct Namespace(pub HashMap<Option<String>, String>);
Namespace is a map from prefixes to namespace URIs.
None prefix means no prefix (i.e. default namespace).
Methods
impl Namespace[src]
fn empty() -> Namespace
Returns an empty namespace.
fn is_empty(&self) -> bool
Checks whether this namespace is empty.
fn is_essentially_empty(&self) -> bool
Checks whether this namespace is essentially empty, that is, it does not contain anything but the default mappings.
fn put<'s1, 's2, S1, S2>(&mut self, prefix: Option<S1>, uri: S2) -> bool where S1: Into<Cow<'s1, str>>, S2: Into<Cow<'s2, str>>
Puts a mapping into this namespace.
This method does not override an already existing mapping.
Returns a boolean flag indicating whether the map already contained the given prefix.
Parameters
prefix--- namespace prefix (Nonemeans default namespace);uri--- namespace URI.
Return value
true if prefix has been inserted successfully; false if the prefix
was already present in the namespace.
fn force_put<'s1, 's2, S1, S2>(&mut self, prefix: Option<S1>, uri: S2) -> Option<String> where S1: Into<Cow<'s1, str>>, S2: Into<Cow<'s2, str>>
Puts a mapping into this namespace forcefully.
This method, as opposed to 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 (Nonemeans default namespace);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.
fn get<'a>(&'a self, prefix: &Option<String>) -> Option<&'a str>
Queries the namespace for the given prefix.
Parameters
prefix--- namespace prefix (Nonemeans default namespace).
Return value
Namespace URI corresponding to the given prefix, if it is present.
Trait Implementations
impl Clone for Namespace[src]
fn clone(&self) -> Namespace
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl PartialEq for Namespace[src]
fn eq(&self, __arg_0: &Namespace) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Namespace) -> bool
This method tests for !=.