pub struct NodeRef<'a> {
pub tag: NodeStr<'a>,
pub attrs: AttrsRef<'a>,
pub content: Option<Box<NodeContentRef<'a>>>,
}Fields§
§tag: NodeStr<'a>§attrs: AttrsRef<'a>§content: Option<Box<NodeContentRef<'a>>>Implementations§
Source§impl<'a> NodeRef<'a>
impl<'a> NodeRef<'a>
pub fn new( tag: NodeStr<'a>, attrs: AttrsRef<'a>, content: Option<NodeContentRef<'a>>, ) -> Self
pub fn attrs(&self) -> AttrParserRef<'_>
pub fn children(&self) -> Option<&[NodeRef<'a>]>
pub fn get_attr(&self, key: &str) -> Option<&ValueRef<'a>>
pub fn attrs_iter(&self) -> impl Iterator<Item = (&NodeStr<'a>, &ValueRef<'a>)>
pub fn get_optional_child_by_tag(&self, tags: &[&str]) -> Option<&NodeRef<'a>>
pub fn get_children_by_tag<'b>(
&'b self,
tag: &'b str,
) -> impl Iterator<Item = &'b NodeRef<'a>>where
'a: 'b,
pub fn get_optional_child(&self, tag: &str) -> Option<&NodeRef<'a>>
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).
Sourcepub fn content_bytes(&self) -> Option<&[u8]>
pub fn content_bytes(&self) -> Option<&[u8]>
Zero-copy byte content, if this node has Bytes content.
Sourcepub fn content_str(&self) -> Option<&str>
pub fn content_str(&self) -> Option<&str>
Zero-copy string content, if this node has String content.
Sourcepub fn content_nodes(&self) -> Option<&[NodeRef<'a>]>
pub fn content_nodes(&self) -> Option<&[NodeRef<'a>]>
Child nodes from content, if this node has Nodes content.
Alias for children().
pub fn to_owned(&self) -> Node
Trait Implementations§
Source§impl EncodeNode for NodeRef<'_>
impl EncodeNode for NodeRef<'_>
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
Source§impl<'a> PartialEq for NodeRef<'a>
impl<'a> PartialEq for NodeRef<'a>
Source§impl<'yoke> Yokeable<'yoke> for NodeRef<'static>
impl<'yoke> Yokeable<'yoke> for NodeRef<'static>
Source§type Output = NodeRef<'yoke>
type Output = NodeRef<'yoke>
This type MUST be
Self with the 'static replaced with 'a, i.e. Self<'a>Source§fn transform_owned(self) -> Self::Output
fn transform_owned(self) -> Self::Output
impl<'a> StructuralPartialEq for NodeRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for NodeRef<'a>
impl<'a> RefUnwindSafe for NodeRef<'a>
impl<'a> Send for NodeRef<'a>
impl<'a> Sync for NodeRef<'a>
impl<'a> Unpin for NodeRef<'a>
impl<'a> UnsafeUnpin for NodeRef<'a>
impl<'a> UnwindSafe for NodeRef<'a>
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