SimpleElement

Trait SimpleElement 

Source
pub trait SimpleElement: Sized {
    // Required methods
    fn encode(&self, write: &mut impl Write) -> Result<()>;
    fn decode(read: &mut impl Read, len: usize) -> Result<Self>;
}
Expand description

This trait provides an easier implementation of Element with not config value as opposed to regular elements, therefore both traits cannot be implemented at the same time.

Required Methods§

Source

fn encode(&self, write: &mut impl Write) -> Result<()>

Encode the element with the given writer.

Source

fn decode(read: &mut impl Read, len: usize) -> Result<Self>

Decode the element from the given reader.

The total length that is available in the reader is also given. Note that the given length will be equal to zero if the element’s length is set to [ElementLength::Unknown] (relevant for top elements).

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§