pub struct MavFrame<M>where
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> MavFrame<M>where
M: Message,
impl<M> MavFrame<M>where
M: Message,
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<MavFrame<M>, ParserError>
pub fn deser( version: MavlinkVersion, input: &[u8], ) -> Result<MavFrame<M>, 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> Arbitrary<'arbitrary> for MavFrame<M>where
M: Message + Arbitrary<'arbitrary>,
impl<'arbitrary, M> Arbitrary<'arbitrary> for MavFrame<M>where
M: Message + Arbitrary<'arbitrary>,
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<MavFrame<M>, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<MavFrame<M>, Error>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(
u: Unstructured<'arbitrary>,
) -> Result<MavFrame<M>, Error>
fn arbitrary_take_rest( u: Unstructured<'arbitrary>, ) -> Result<MavFrame<M>, Error>
Self from the entirety of the given
unstructured data. Read more