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: MavHeader
§msg: M
§protocol_version: MavlinkVersion
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
Create a new frame with given message Serialize MavFrame into a vector, 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.
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.
Trait Implementations§
Auto Trait Implementations§
impl<M> Freeze for MavFrame<M>where
M: Freeze,
impl<M> RefUnwindSafe for MavFrame<M>where
M: RefUnwindSafe,
impl<M> Send for MavFrame<M>where
M: Send,
impl<M> Sync for MavFrame<M>where
M: Sync,
impl<M> Unpin for MavFrame<M>where
M: Unpin,
impl<M> UnwindSafe for MavFrame<M>where
M: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)