pub trait MessageCodec: Default + 'static {
type Unpacked;
const PAYLOAD_BITS: u32;
const CRC_BITS: u32;
// Required methods
fn pack(&self, fields: &MessageFields) -> Option<Vec<u8>>;
fn unpack(
&self,
payload: &[u8],
ctx: &DecodeContext,
) -> Option<Self::Unpacked>;
}Expand description
Human-facing message payload codec (callsigns, grids, reports, free text).
Operates on the FEC-decoded information bits (PAYLOAD_BITS wide, NOT
including any CRC protecting them — callers handle the CRC layer).
Unlike FecCodec, this trait is an acceptable place for dyn when the
caller juggles heterogeneous protocols at runtime (FFI, CLI dump tools):
message unpacking is a cold path relative to DSP/FEC inner loops.
Required Associated Constants§
Sourceconst PAYLOAD_BITS: u32
const PAYLOAD_BITS: u32
Number of information bits consumed by pack / produced by unpack.
Required Associated Types§
Required 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.