Trait Coder

Source
pub trait Coder {
    type Tx: Debug + Clone + PartialEq + Eq;

    // Required methods
    fn encode(t: &Self::Tx) -> Vec<u8> ;
    fn decode(buf: &mut &[u8]) -> Option<Self::Tx>
       where Self: Sized;
}
Expand description

Encode/Decode trait for inner tx type

Required Associated Types§

Source

type Tx: Debug + Clone + PartialEq + Eq

The inner tx type.

Required Methods§

Source

fn encode(t: &Self::Tx) -> Vec<u8>

Encode the tx.

Source

fn decode(buf: &mut &[u8]) -> Option<Self::Tx>
where Self: Sized,

Decode the tx.

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§