pub trait MessageRef<'a>: Sized {
const NAME: &'static str;
const SEGMENTS: &'static [SegmentDef<'static>];
const COVERED: &'static [CoverDef<'static>] = _;
// Required methods
fn decode(bytes: &'a [u8]) -> Result<(Self, usize), ParseError>;
fn encode_into<B>(&self, out: &mut B) -> Result<(), Overflow>
where B: Buffer;
// Provided methods
fn encode(&self) -> Vec<u8> ⓘ { ... }
fn audit() -> MessageRecords<'static> { ... }
}Expand description
A variable-length type whose fields borrow the bytes it decodes from.
#[derive(Message)] implements it, instead of Message, on a struct with a lifetime:
&'a [u8] and &'a [u8; N] fields are views of the input, so decode needs no allocator. It
has no parameters, and no other message can hold it, since Message decodes from bytes it
does not keep.
Required Associated Constants§
Sourceconst SEGMENTS: &'static [SegmentDef<'static>]
const SEGMENTS: &'static [SegmentDef<'static>]
The segment table, in wire order.
Provided Associated Constants§
Required Methods§
Provided Methods§
Sourcefn encode(&self) -> Vec<u8> ⓘ
Available on crate feature alloc only.
fn encode(&self) -> Vec<u8> ⓘ
alloc only.encode_into into a new vector.
Sourcefn audit() -> MessageRecords<'static>
fn audit() -> MessageRecords<'static>
The audit records for this message.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".