Trait mavio::Dialect

source ·
pub trait Dialect: MessageSpec + IntoPayload + Sized + Sync + Send {
    // Required methods
    fn name() -> &'static str;
    fn dialect() -> Option<u32>;
    fn version() -> Option<u8>;
    fn message_info(id: u32) -> Result<&'static dyn MessageSpec, SpecError>;
    fn decode(payload: &Payload) -> Result<Self, SpecError>;
    fn spec() -> &'static DialectSpec;
}
Expand description

Interface for autogenerated or custom MAVLink dialect specification.

Required Methods§

source

fn name() -> &'static str

Dialect name as it appears in XML definition.

source

fn dialect() -> Option<u32>

Returns dialect identifier as specified in MAVLink XML definitions.

source

fn version() -> Option<u8>

Minor dialect version as specified in MAVLink XML definitions.

Corresponds to uint8_t_mavlink_version.

Dialect version appears in some messages like HEARTBEAT. In such cases it is usually not directly set by user.

source

fn message_info(id: u32) -> Result<&'static dyn MessageSpec, SpecError>

Message specification by id.

Clients may access this method to retrieve message specification prior to decoding it from payload.

§Errors

Returns SpecError::NotInDialect if message with specified ID is not supported.

source

fn decode(payload: &Payload) -> Result<Self, SpecError>

Decode dialect message from Payload.

source

fn spec() -> &'static DialectSpec

Dialect specification.

Object Safety§

This trait is not object safe.

Implementors§