Struct mavio::AsyncSender
source · pub struct AsyncSender<W: AsyncWrite + Unpin, V: MaybeVersioned> { /* private fields */ }
Expand description
Sends MAVLink frames asynchronously.
Sends MAVLink frames to an instance of AsyncWrite
.
Implementations§
source§impl<W: AsyncWrite + Unpin> AsyncSender<W, Versionless>
impl<W: AsyncWrite + Unpin> AsyncSender<W, Versionless>
sourcepub fn new<V: MaybeVersioned>(writer: W) -> AsyncSender<W, V>
pub fn new<V: MaybeVersioned>(writer: W) -> AsyncSender<W, V>
Default constructor.
sourcepub fn versionless(writer: W) -> Self
pub fn versionless(writer: W) -> Self
Create a MAVLink version agnostic sender.
Creates a protocol-agnostic sender which can send both MAVLink 1
and MAVLink 2
frames.
If you want a sender that sends only frames restricted to a particular MAVLink protocol
version, use AsyncSender::versioned
.
If you want to instantiate a generic sender, use AsyncSender::new
.
sourcepub fn versioned<Version: Versioned>(
writer: W,
version: Version
) -> AsyncSender<W, Version>
pub fn versioned<Version: Versioned>( writer: W, version: Version ) -> AsyncSender<W, Version>
Create a receiver specific to a particular MAVLink protocol version.
Same as AsyncSender::new::<V1>
/ AsyncSender::new::<V2>
but with an explicit
version
marker as parameter.
If you want to send both MAVLink 1
and MAVLink 2
frames, use AsyncSender::versionless
.
source§impl<W: AsyncWrite + Unpin, V: MaybeVersioned> AsyncSender<W, V>
impl<W: AsyncWrite + Unpin, V: MaybeVersioned> AsyncSender<W, V>
sourcepub async fn send(&mut self, frame: &Frame<V>) -> Result<usize>
pub async fn send(&mut self, frame: &Frame<V>) -> Result<usize>
Send MAVLink Frame
asynchronously.
Versioned
sender accepts only frames of a specific MAVLink protocol version.
Versionless
sender accepts both MAVLink 1
and MAVLink 2
frames as
Frame<Versionless>
.
Returns the number of bytes sent.
Trait Implementations§
source§impl<W: Clone + AsyncWrite + Unpin, V: Clone + MaybeVersioned> Clone for AsyncSender<W, V>
impl<W: Clone + AsyncWrite + Unpin, V: Clone + MaybeVersioned> Clone for AsyncSender<W, V>
source§fn clone(&self) -> AsyncSender<W, V>
fn clone(&self) -> AsyncSender<W, V>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more