Enum minidom::element::Node
[−]
[src]
pub enum Node { Element(Element), Text(String), }
A node in an element tree.
Variants
Element(Element)
An Element
.
Text(String)
A text node.
Methods
impl Node
[src]
fn as_element(&self) -> Option<&Element>
Turns this into an Element
if possible, else returns None.
Examples
use minidom::Node; let elm = Node::Element("<meow />".parse().unwrap()); let txt = Node::Text("meow".to_owned()); assert_eq!(elm.as_element().unwrap().name(), "meow"); assert_eq!(txt.as_element(), None);
fn as_text(&self) -> Option<&str>
Turns this into a String
if possible, else returns None.
Examples
use minidom::Node; let elm = Node::Element("<meow />".parse().unwrap()); let txt = Node::Text("meow".to_owned()); assert_eq!(elm.as_text(), None); assert_eq!(txt.as_text().unwrap(), "meow");
Trait Implementations
impl Clone for Node
[src]
fn clone(&self) -> Node
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 Debug for Node
[src]
impl PartialEq for Node
[src]
fn eq(&self, __arg_0: &Node) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Node) -> bool
This method tests for !=
.