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§
Sourcefn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message.
Sourcefn encode_raw<B>(&self, buf: &mut B)where
B: BufMut,
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§
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.