pub struct Node {
pub tag: Cow<'static, str>,
pub attrs: Attrs,
pub content: Option<NodeContent>,
}Fields§
§tag: Cow<'static, str>§attrs: Attrs§content: Option<NodeContent>Implementations§
Source§impl Node
impl Node
pub fn new( tag: impl Into<Cow<'static, str>>, attrs: Attrs, content: Option<NodeContent>, ) -> Self
Sourcepub fn as_node_ref(&self) -> NodeRef<'_>
pub fn as_node_ref(&self) -> NodeRef<'_>
Convert an owned Node to a borrowed NodeRef. The returned NodeRef borrows from self.
pub fn children(&self) -> Option<&[Node]>
pub fn attrs(&self) -> AttrParser<'_>
pub fn get_optional_child_by_tag<'a>( &'a self, tags: &[&str], ) -> Option<&'a Node>
pub fn get_children_by_tag<'a>( &'a self, tag: &'a str, ) -> impl Iterator<Item = &'a Node>
pub fn get_optional_child(&self, tag: &str) -> Option<&Node>
Sourcepub fn content_as_string(&self) -> Option<CompactString>
pub fn content_as_string(&self) -> Option<CompactString>
Extract text content, handling both String and Bytes (lossy UTF-8).
Trait Implementations§
Source§impl EncodeNode for Node
impl EncodeNode for Node
fn tag(&self) -> &str
fn attrs_len(&self) -> usize
fn has_content(&self) -> bool
Source§fn encode_attrs<'a, W: ByteWriter>(
&self,
encoder: &mut Encoder<'a, W>,
) -> Result<()>
fn encode_attrs<'a, W: ByteWriter>( &self, encoder: &mut Encoder<'a, W>, ) -> Result<()>
Encode all attributes to the encoder
Source§fn encode_content<'a, W: ByteWriter>(
&self,
encoder: &mut Encoder<'a, W>,
) -> Result<()>
fn encode_content<'a, W: ByteWriter>( &self, encoder: &mut Encoder<'a, W>, ) -> Result<()>
Encode content (string, bytes, or child nodes) to the encoder
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
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