#[non_exhaustive]pub struct MessageDef {
pub name: String,
pub endian: Endian,
pub bits: Option<BitOrder>,
pub needs: Vec<Param>,
pub segments: Vec<Segment>,
pub doc: Option<String>,
pub derives: Vec<Derive>,
pub lifetime: Option<String>,
}Expand description
A variable-length message.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringThe type name.
endian: EndianThe byte order.
bits: Option<BitOrder>The bit order, or None for a byte-addressed message.
A bit-addressed message holds bit fields and inline presence bits, padded with zeros to a whole byte.
needs: Vec<Param>The parameters, which generate a <Name>Ctx struct used as Message::Ctx.
segments: Vec<Segment>The segments, in wire order.
doc: Option<String>Documentation.
derives: Vec<Derive>Derives for this message, written after the module’s.
lifetime: Option<String>The lifetime of borrowed fields, without the ': Some("a")
declares Name<'a>.
The message implements layline::MessageRef<'a> instead of layline::Message, so it
takes no needs and no other message can hold it.
Implementations§
Source§impl MessageDef
impl MessageDef
Sourcepub fn new(name: &str, segments: Vec<Segment>) -> Self
pub fn new(name: &str, segments: Vec<Segment>) -> Self
A little-endian, byte-addressed message.
Sourcepub fn with_lifetime(self, lifetime: &str) -> Self
pub fn with_lifetime(self, lifetime: &str) -> Self
Declares Name<'lifetime>, whose borrowed fields hold views of the input.
Sourcepub fn with_derives(self, derives: Vec<Derive>) -> Self
pub fn with_derives(self, derives: Vec<Derive>) -> Self
Sets the derives written on this message, after the module’s.
Sourcepub fn with_needs(self, needs: Vec<Param>) -> Self
pub fn with_needs(self, needs: Vec<Param>) -> Self
Sets the parameters.
Sourcepub fn with_endian(self, endian: Endian) -> Self
pub fn with_endian(self, endian: Endian) -> Self
Sets the byte order.