Skip to main content

FrameWrite

Trait FrameWrite 

Source
pub trait FrameWrite {
    type Error: Debug;

    // Required method
    fn encode<W: Writer>(&self, buf: &mut W) -> Result<(), Self::Error>;
}
Expand description

Encodes Self into a Writer.

A single generic method covers both alloc (BytesMut) and no-alloc (&mut [u8]) targets - no cfg splits required in implementations.

Most types should use #[derive(FrameWrite)] from ace-macros.

Required Associated Types§

Required Methods§

Source

fn encode<W: Writer>(&self, buf: &mut W) -> Result<(), Self::Error>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FrameWrite for &[u8]

Source§

type Error = DiagError

Source§

fn encode<W: Writer>(&self, buf: &mut W) -> Result<(), Self::Error>

Source§

impl FrameWrite for u8

Source§

type Error = DiagError

Source§

fn encode<W: Writer>(&self, buf: &mut W) -> Result<(), Self::Error>

Source§

impl FrameWrite for u16

Source§

type Error = DiagError

Source§

fn encode<W: Writer>(&self, buf: &mut W) -> Result<(), Self::Error>

Source§

impl FrameWrite for u32

Source§

type Error = DiagError

Source§

fn encode<W: Writer>(&self, buf: &mut W) -> Result<(), Self::Error>

Source§

impl<T: FrameWrite> FrameWrite for Option<T>

Source§

type Error = <T as FrameWrite>::Error

Source§

fn encode<W: Writer>(&self, buf: &mut W) -> Result<(), Self::Error>

Source§

impl<const N: usize> FrameWrite for [u8; N]

Source§

type Error = DiagError

Source§

fn encode<W: Writer>(&self, buf: &mut W) -> Result<(), Self::Error>

Implementors§

Source§

impl<'a, T> FrameWrite for FrameIter<'a, T>

Encodes by writing the raw underlying bytes directly.

FrameIter stores the original encoded bytes verbatim - encoding simply copies them out. No re-decode/re-encode cycle is needed or performed. No bounds on T required since the bytes are written as-is.