pub struct MessageDescriptorBuilder { /* private fields */ }Expand description
Builds a message shape from a definition written the way a dialect reads.
Fields are given in declaration order. MAVLink puts the base fields on the wire largest
type first, keeping equal-sized fields in the order declared, and leaves extension
fields at the end untouched; build applies that and derives the
CRC_EXTRA seed from the result, so a transcription error surfaces as a checksum a
peer rejects rather than as silently misread fields.
Implementations§
Source§impl MessageDescriptorBuilder
impl MessageDescriptorBuilder
Sourcepub fn extension(
self,
name: impl Into<String>,
ty: FieldType,
array_len: u8,
) -> Self
pub fn extension( self, name: impl Into<String>, ty: FieldType, array_len: u8, ) -> Self
Adds a MAVLink 2 extension field, in the order the definition declares it.
Extensions keep their declared order, are excluded from the CRC_EXTRA seed, and
read as zero from a frame sent by a peer that predates them.
§Arguments
name- the field name.ty- the field’s scalar type, or an array’s element type.array_len- the element count for an array, or0for a scalar.
§Returns
The builder.
Sourcepub fn build(self) -> Result<OwnedMessageDescriptor>
pub fn build(self) -> Result<OwnedMessageDescriptor>
Puts the fields in wire order and derives the seed.
§Returns
The finished shape.
§Errors
Returns MavlinkError::DuplicateField if two fields share a name, and
MavlinkError::PayloadTooLong if the fields do not fit a MAVLink payload.
Trait Implementations§
Source§impl Clone for MessageDescriptorBuilder
impl Clone for MessageDescriptorBuilder
Source§fn clone(&self) -> MessageDescriptorBuilder
fn clone(&self) -> MessageDescriptorBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more