pub struct MavFrame<M: Message> {
pub header: MavHeader,
pub msg: M,
pub protocol_version: MavlinkVersion,
}Expand description
Encapsulation of the MAVLink message and the header, important to preserve information about the sender system and component id.
Fields§
§header: MavHeaderMessage header data
msg: MParsed Message payload
protocol_version: MavlinkVersionMessages MAVLink version
Implementations§
Source§impl<M: Message> MavFrame<M>
impl<M: Message> MavFrame<M>
Sourcepub fn ser(&self, buf: &mut [u8]) -> usize
pub fn ser(&self, buf: &mut [u8]) -> usize
Serialize MavFrame into a byte slice, so it can be sent over a socket, for example. The resulting buffer will start with the sequence field of the MAVLink frame and will not include the initial packet marker, length field, and flags.
§Panics
- If the frame does not fit in the provided buffer
- When attempting to serialize a message with an id greater then 255 with MAVLink 1
Sourcepub fn deser(version: MavlinkVersion, input: &[u8]) -> Result<Self, ParserError>
pub fn deser(version: MavlinkVersion, input: &[u8]) -> Result<Self, ParserError>
Deserialize MavFrame from a slice that has been received from, for example, a socket. The input buffer should start with the sequence field of the MAVLink frame. The initial packet marker, length field, and flag fields should be excluded.
§Errors
Will return a ParserError if a message was found but could not be parsed
or the if the buffer provided does not contain a full message
Trait Implementations§
Source§impl<'arbitrary, M: Message + Arbitrary<'arbitrary>> Arbitrary<'arbitrary> for MavFrame<M>
impl<'arbitrary, M: Message + Arbitrary<'arbitrary>> Arbitrary<'arbitrary> for MavFrame<M>
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self from the entirety of the given
unstructured data. Read more