pub struct Node<'doc, 'input> { /* private fields */ }Implementations§
Source§impl<'doc, 'input> Node<'doc, 'input>
impl<'doc, 'input> Node<'doc, 'input>
pub fn has_attributes(self) -> bool
pub fn attributes(self) -> Attributes<'doc, 'input> ⓘ
Source§impl<'doc, 'input> Node<'doc, 'input>
impl<'doc, 'input> Node<'doc, 'input>
pub fn id(self) -> NodeId
pub fn is_root(&self) -> bool
pub fn is_element(&self) -> bool
pub fn is_text(&self) -> bool
pub fn parent(self) -> Option<Self>
pub fn ancestors(self) -> impl Iterator<Item = Self> + Clone
pub fn prev_sibling(self) -> Option<Self>
pub fn prev_siblings(self) -> impl Iterator<Item = Self> + Clone
pub fn prev_sibling_element(self) -> Option<Self>
pub fn next_sibling(self) -> Option<Self>
pub fn next_siblings(self) -> impl Iterator<Item = Self> + Clone
pub fn next_sibling_element(self) -> Option<Self>
pub fn has_children(self) -> bool
pub fn first_child(self) -> Option<Self>
pub fn first_child_element(self) -> Option<Self>
pub fn last_child(self) -> Option<Self>
pub fn last_child_element(self) -> Option<Self>
pub fn children(self) -> Children<'doc, 'input> ⓘ
pub fn child_elements(self) -> impl DoubleEndedIterator<Item = Self> + Clone
Sourcepub fn descendants(self) -> Descendants<'doc, 'input> ⓘ
pub fn descendants(self) -> Descendants<'doc, 'input> ⓘ
let doc = Document::parse(r#"<root><parent><child/></parent></root>"#).unwrap();
let mut nodes = doc.root_element().descendants();
let node = nodes.next().unwrap();
assert_eq!(node.name(), Some(Name { namespace: None, local: "root" }));
let node = nodes.next().unwrap();
assert_eq!(node.name(), Some(Name { namespace: None, local: "parent" }));
let node = nodes.next().unwrap();
assert_eq!(node.name(), Some(Name { namespace: None, local: "child" }));
assert_eq!(nodes.next(), None);pub fn name(self) -> Option<Name<'doc, 'input>>
pub fn text(self) -> Option<&'doc str>
pub fn child_texts(self) -> impl Iterator<Item = &'doc str> + Clone
Sourcepub fn child_text(self) -> Option<Cow<'doc, str>>
pub fn child_text(self) -> Option<Cow<'doc, str>>
let doc = Document::parse(r#"<root>foo<child>bar</child>baz</root>"#).unwrap();
let text = doc.root_element().child_text();
assert_eq!(text, Some(Cow::Owned("foobaz".to_owned())));pub fn descedant_texts(self) -> impl Iterator<Item = &'doc str> + Clone
Sourcepub fn descedant_text(self) -> Option<Cow<'doc, str>>
pub fn descedant_text(self) -> Option<Cow<'doc, str>>
let doc = Document::parse(r#"<root>foo<child>bar</child>baz</root>"#).unwrap();
let text = doc.root_element().descedant_text();
assert_eq!(text, Some(Cow::Owned("foobarbaz".to_owned())));Trait Implementations§
Source§impl Ord for Node<'_, '_>
impl Ord for Node<'_, '_>
Source§impl PartialOrd for Node<'_, '_>
impl PartialOrd for Node<'_, '_>
impl<'doc, 'input> Copy for Node<'doc, 'input>
impl Eq for Node<'_, '_>
Auto Trait Implementations§
impl<'doc, 'input> Freeze for Node<'doc, 'input>
impl<'doc, 'input> RefUnwindSafe for Node<'doc, 'input>
impl<'doc, 'input> !Send for Node<'doc, 'input>
impl<'doc, 'input> !Sync for Node<'doc, 'input>
impl<'doc, 'input> Unpin for Node<'doc, 'input>
impl<'doc, 'input> UnwindSafe for Node<'doc, 'input>
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
Mutably borrows from an owned value. Read more