Skip to main content

EncodeNode

Trait EncodeNode 

Source
pub trait EncodeNode {
    // Required methods
    fn tag(&self) -> &str;
    fn attrs_len(&self) -> usize;
    fn has_content(&self) -> bool;
    fn encode_attrs<'a, W: ByteWriter>(
        &self,
        encoder: &mut Encoder<'a, W>,
    ) -> Result<()>;
    fn encode_content<'a, W: ByteWriter>(
        &self,
        encoder: &mut Encoder<'a, W>,
    ) -> Result<()>;
}
Expand description

Trait for encoding node structures (both owned Node and borrowed NodeRef). All encoding logic lives in the trait implementation, keeping the Encoder simple and focused on low-level byte writing.

Required Methods§

Source

fn tag(&self) -> &str

Source

fn attrs_len(&self) -> usize

Source

fn has_content(&self) -> bool

Source

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<()>

Encode content (string, bytes, or child nodes) to the encoder

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§