Encodable

Trait Encodable 

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

Data which can be encoded in a consensus-consistent way.

Required Methods§

Source

fn encode<W: Write>(&self, e: &mut W) -> Result<usize, Error>

Encode an object with a well-defined format. Should only ever error if the underlying Write errors. Returns the number of bytes written on success.

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 Encodable for &str

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Source§

impl Encodable for bool

Source§

impl Encodable for f32

Source§

impl Encodable for f64

Source§

impl Encodable for i8

Source§

impl Encodable for i16

Source§

impl Encodable for i32

Source§

impl Encodable for i64

Source§

impl Encodable for i128

Source§

impl Encodable for u8

Source§

impl Encodable for u16

Source§

impl Encodable for u32

Source§

impl Encodable for u64

Source§

impl Encodable for u128

Source§

impl Encodable for usize

Source§

impl Encodable for String

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Source§

impl Encodable for BuildMetadata

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize>

Source§

impl Encodable for Prerelease

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize>

Source§

impl Encodable for Version

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize>

Source§

impl<T0: Encodable, T1: Encodable> Encodable for (T0, T1)

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Source§

impl<T0: Encodable, T1: Encodable, T2: Encodable> Encodable for (T0, T1, T2)

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Source§

impl<T0: Encodable, T1: Encodable, T2: Encodable, T3: Encodable> Encodable for (T0, T1, T2, T3)

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Source§

impl<T0: Encodable, T1: Encodable, T2: Encodable, T3: Encodable, T4: Encodable> Encodable for (T0, T1, T2, T3, T4)

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Source§

impl<T0: Encodable, T1: Encodable, T2: Encodable, T3: Encodable, T4: Encodable, T5: Encodable> Encodable for (T0, T1, T2, T3, T4, T5)

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Source§

impl<T0: Encodable, T1: Encodable, T2: Encodable, T3: Encodable, T4: Encodable, T5: Encodable, T6: Encodable> Encodable for (T0, T1, T2, T3, T4, T5, T6)

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Source§

impl<T0: Encodable, T1: Encodable, T2: Encodable, T3: Encodable, T4: Encodable, T5: Encodable, T6: Encodable, T7: Encodable> Encodable for (T0, T1, T2, T3, T4, T5, T6, T7)

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Source§

impl<T, const N: usize> Encodable for [T; N]
where T: Encodable,

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Source§

impl<T: Encodable> Encodable for Option<T>

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Source§

impl<T: Encodable> Encodable for VecDeque<T>

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Source§

impl<T: Encodable> Encodable for Vec<T>

Source§

fn encode<S: Write>(&self, s: &mut S) -> Result<usize, Error>

Implementors§