pub trait BitEncode {
const LAYOUT: Layout = _;
// Required method
fn bit_encode<K: Sink>(&self, w: &mut K) -> Result<(), BitError>;
// Provided method
fn canonical_bit_encode<K: Sink>(&self, w: &mut K) -> Result<(), BitError> { ... }
}Expand description
A message encoded to a bit stream — the dual of BitDecode.
Encoding has two forms: the required bit_encode
is verbatim (exactly what’s stored), and canonical_bit_encode
is canonical (reserved → spec value, calc → recomputed). The default canonical
impl just calls bit_encode, so the two are identical unless a #[bin] message has a
reserved or non-temp calc field — in which case the derive overrides it.
Provided Associated Constants§
Required Methods§
Provided Methods§
Sourcefn canonical_bit_encode<K: Sink>(&self, w: &mut K) -> Result<(), BitError>
fn canonical_bit_encode<K: Sink>(&self, w: &mut K) -> Result<(), BitError>
Encodes self’s canonical form into any Sink: reserved fields as their
spec value, calc fields recomputed. Defaults to bit_encode
(verbatim == canonical) for messages with no reserved/calc field.
§Errors
Propagates the sink’s BitError.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".