Trait Encodable

Source
pub trait Encodable: Sized {
    // Required methods
    fn encoded_len(&self) -> usize;
    fn encode_raw<B>(&self, buf: &mut B)
       where B: BufMut;

    // Provided method
    fn encode<B>(&self, buf: &mut B) -> Result<(), InsufficientCapacity>
       where B: BufMut { ... }
}
Expand description

Provides a common interface for the serialization of bitcoin structures.

Required Methods§

Source

fn encoded_len(&self) -> usize

Returns the encoded length of the message.

Source

fn encode_raw<B>(&self, buf: &mut B)
where B: BufMut,

Encodes structure to a buffer. This panics if buffer contains insufficient capacity.

Provided Methods§

Source

fn encode<B>(&self, buf: &mut B) -> Result<(), InsufficientCapacity>
where B: BufMut,

Encodes structure to a buffer.

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§