pub trait RlpEncode {
type Error;
// Required methods
fn encoded_rlp_len(&self) -> Result<usize, Self::Error>;
fn encode_rlp(&self, output: &mut [u8]) -> Result<usize, Self::Error>;
}Expand description
RLP encoding contract for derive-generated and hand-written domains.
Implementations must return the exact encoded length and must not modify the output buffer when they reject before writing.
Aggregate encoders, including derive-generated struct encoders, may already have written a valid prefix when a later field encoder returns an error or reports an inconsistent byte count. Callers must treat the returned length as authoritative and must discard the output buffer on any error.
Required Associated Types§
Required Methods§
Sourcefn encoded_rlp_len(&self) -> Result<usize, Self::Error>
fn encoded_rlp_len(&self) -> Result<usize, Self::Error>
Returns the exact canonical RLP encoded length.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".