pub struct Element {
pub name: String,
pub attrs: Vec<(String, String)>,
pub content: Vec<Content>,
}Expand description
An XML element: name, attributes in document order, and content.
Fields§
§name: StringThe element name.
attrs: Vec<(String, String)>The attributes, in document order.
content: Vec<Content>Text chunks and child elements.
Implementations§
Source§impl Element
impl Element
Sourcepub fn attr(&self, name: &str) -> Option<&str>
pub fn attr(&self, name: &str) -> Option<&str>
The value of an attribute (attrs[name] / attrs.get(name)).
Sourcepub fn elements(&self) -> impl Iterator<Item = &Element>
pub fn elements(&self) -> impl Iterator<Item = &Element>
The child elements, skipping text (the common
if not isinstance(element, tuple): continue loop).
Sourcepub fn text_chunks(&self) -> impl Iterator<Item = &str>
pub fn text_chunks(&self) -> impl Iterator<Item = &str>
The text chunks, in order.
Trait Implementations§
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Forget for Element
impl Freeze for Elementwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<(String, String)>: Freeze,
PhantomData<Content>: Freeze,
impl Move for Element
impl RefUnwindSafe for Element
impl Send for Elementwhere
RawVecInner: Send,
impl Sync for Elementwhere
RawVecInner: Sync,
impl Unpin for Element
impl UnsafeUnpin for Elementwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(String, String)>: UnsafeUnpin,
PhantomData<Content>: UnsafeUnpin,
impl UnwindSafe for Elementwhere
RawVecInner: UnwindSafe,
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