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§
fn tag(&self) -> &str
fn attrs_len(&self) -> usize
fn has_content(&self) -> bool
Sourcefn 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
Sourcefn 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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".