Trait Message

Source
pub trait Message: Sized {
    // Required methods
    fn message_id(&self) -> u32;
    fn message_name(&self) -> &'static str;
    fn ser(&self, version: MavlinkVersion, bytes: &mut [u8]) -> usize;
    fn parse(
        version: MavlinkVersion,
        msgid: u32,
        payload: &[u8],
    ) -> Result<Self, ParserError>;
    fn message_id_from_name(name: &str) -> Result<u32, &'static str>;
    fn default_message_from_id(id: u32) -> Result<Self, &'static str>;
    fn extra_crc(id: u32) -> u8;
}
Expand description

A MAVLink message payload

Each message sets MavMessage enum implements this trait. The Message trait is used to represent messages in an abstract way (for example, common::MavMessage).

Required Methods§

Source

fn message_id(&self) -> u32

MAVLink message ID

Source

fn message_name(&self) -> &'static str

MAVLink message name

Source

fn ser(&self, version: MavlinkVersion, bytes: &mut [u8]) -> usize

Serialize Message into byte slice and return count of bytes written

Source

fn parse( version: MavlinkVersion, msgid: u32, payload: &[u8], ) -> Result<Self, ParserError>

Parse a Message from its message id and payload bytes

Source

fn message_id_from_name(name: &str) -> Result<u32, &'static str>

Return message id of specific message name

Source

fn default_message_from_id(id: u32) -> Result<Self, &'static str>

Return a default message of the speicfied message id

Source

fn extra_crc(id: u32) -> u8

Return a message types CRC_EXTRA byte

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.

Implementors§

Source§

impl Message for mavlink::ardupilotmega::MavMessage

Available on crate feature ardupilotmega only.
Source§

impl Message for mavlink::asluav::MavMessage

Available on crate feature asluav only.
Source§

impl Message for mavlink::avssuas::MavMessage

Available on crate feature avssuas only.
Source§

impl Message for mavlink::common::MavMessage

Available on crate feature common only.
Source§

impl Message for mavlink::csairlink::MavMessage

Available on crate feature csairlink only.
Source§

impl Message for mavlink::cubepilot::MavMessage

Available on crate feature cubepilot only.
Source§

impl Message for mavlink::development::MavMessage

Available on crate feature development only.
Source§

impl Message for mavlink::icarous::MavMessage

Available on crate feature icarous only.
Source§

impl Message for mavlink::loweheiser::MavMessage

Available on crate feature loweheiser only.
Source§

impl Message for mavlink::matrixpilot::MavMessage

Available on crate feature matrixpilot only.
Source§

impl Message for mavlink::minimal::MavMessage

Available on crate feature minimal only.
Source§

impl Message for mavlink::paparazzi::MavMessage

Available on crate feature paparazzi only.
Source§

impl Message for mavlink::python_array_test::MavMessage

Available on crate feature python_array_test only.
Source§

impl Message for mavlink::standard::MavMessage

Available on crate feature standard only.
Source§

impl Message for mavlink::storm32::MavMessage

Available on crate feature storm32 only.
Source§

impl Message for mavlink::test::MavMessage

Available on crate feature test only.
Source§

impl Message for mavlink::ualberta::MavMessage

Available on crate feature ualberta only.
Source§

impl Message for mavlink::uavionix::MavMessage

Available on crate feature uavionix only.