Trait Encode

Source
pub trait Encode {
    // Required method
    fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>;
}
Expand description

Things that can be encoded as binary.

Required Methods§

Source

fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>

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.

Implementations on Foreign Types§

Source§

impl Encode for &str

Source§

fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>

Source§

impl Encode for u8

Source§

fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>

Source§

impl Encode for u16

Source§

fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>

Source§

impl Encode for u32

Source§

fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>

Source§

impl Encode for u64

Source§

fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>

Source§

impl Encode for String

Source§

fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>

Source§

impl Encode for OnionAddrV3

Source§

fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>

Source§

impl<A, B> Encode for (A, B)
where A: Encode, B: Encode,

Source§

fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>

Source§

impl<T> Encode for &[T]
where T: Encode,

Source§

fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>

Source§

impl<const T: usize> Encode for &[u8; T]

Source§

fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>

Source§

impl<const T: usize> Encode for [u8; T]

Source§

fn encode<W: Write + ?Sized>(&self, writer: &mut W) -> Result<usize, Error>

Implementors§