Skip to main content

Encodable

Trait Encodable 

Source
pub trait Encodable: Sized {
    // Required method
    fn encode(&self, writer: &mut TdfWriter);

    // Provided method
    fn encode_bytes(&self) -> Vec<u8>  { ... }
}
Expand description

Trait for something that can be encoded onto a TdfWriter

Required Methods§

Source

fn encode(&self, writer: &mut TdfWriter)

Function for implementing encoding of Self to the provided vec of bytes

writer The output to encode to

Provided Methods§

Source

fn encode_bytes(&self) -> Vec<u8>

Shortcut function for encoding self directly to a Vec of bytes

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

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for bool

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for f32

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for i8

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for i16

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for i32

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for i64

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for isize

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for u8

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for u16

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for u32

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for u64

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for usize

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl Encodable for String

Source§

fn encode(&self, output: &mut TdfWriter)

Source§

impl<C> Encodable for &[C]
where C: Encodable + ValueType,

Support for encoding slices of encodable items as lists

Source§

fn encode(&self, writer: &mut TdfWriter)

Source§

impl<C> Encodable for Vec<C>
where C: Encodable + ValueType,

Vec List encoding for encodable items items are required to have the ValueType trait in order to write the list header

Source§

fn encode(&self, writer: &mut TdfWriter)

Implementors§

Source§

impl Encodable for Blob

Source§

impl<A, B> Encodable for Pair<A, B>
where A: VarInt, B: VarInt,

Source§

impl<A, B, C> Encodable for Triple<A, B, C>
where A: VarInt, B: VarInt, C: VarInt,

Source§

impl<C> Encodable for Union<C>
where C: Encodable + ValueType,

Source§

impl<C> Encodable for VarIntList<C>
where C: VarInt,

Source§

impl<K, V> Encodable for TdfMap<K, V>