pub struct Element<'d> { /* private fields */ }Expand description
A borrowed handle to one element, carrying the arena it came from.
This is the type the semantic pass works with. It is Copy and two words wide, so
navigation (child, children, attr) is free of allocation and of lifetime noise.
Implementations§
Source§impl<'d> Element<'d>
impl<'d> Element<'d>
Sourcepub fn children_with(self, tag: Tag) -> impl Iterator<Item = Element<'d>>
pub fn children_with(self, tag: Tag) -> impl Iterator<Item = Element<'d>>
Direct children with the given tag.
Sourcepub fn descendant(self, tag: Tag) -> Option<Element<'d>>
pub fn descendant(self, tag: Tag) -> Option<Element<'d>>
The first descendant with the given tag, searched depth-first.
Mirrors the reference implementation’s element.find(".//Tag"), which is how it
locates a data encoding anywhere under a parameter type.
Sourcepub fn descendant_any(self, tags: &[Tag]) -> Option<Element<'d>>
pub fn descendant_any(self, tags: &[Tag]) -> Option<Element<'d>>
The first descendant matching any of tags, searched depth-first, preferring the
shallowest match and then document order.
Sourcepub fn attr_named(self, name: &str) -> Option<&'d str>
pub fn attr_named(self, name: &str) -> Option<&'d str>
An attribute value by literal name, for attributes outside AttrKey.
Sourcepub fn attr_names(self) -> impl Iterator<Item = &'d str>
pub fn attr_names(self) -> impl Iterator<Item = &'d str>
Attribute names present on this element, in document order.
Trait Implementations§
Auto Trait Implementations§
impl<'d> Forget for Element<'d>
impl<'d> Freeze for Element<'d>
impl<'d> Move for Element<'d>
impl<'d> RefUnwindSafe for Element<'d>
impl<'d> Send for Element<'d>
impl<'d> Sync for Element<'d>
impl<'d> Unpin for Element<'d>
impl<'d> UnsafeUnpin for Element<'d>
impl<'d> UnwindSafe for Element<'d>
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