pub struct AsyncSender<E: Into<Error>, W: AsyncWrite<E>, V: MaybeVersioned> { /* private fields */ }Expand description
Sends MAVLink frames asynchronously.
Sends MAVLink frames to an instance of AsyncWrite.
Implementations§
Source§impl<E: Into<Error>, W: AsyncWrite<E>> AsyncSender<E, W, Versionless>
impl<E: Into<Error>, W: AsyncWrite<E>> AsyncSender<E, W, Versionless>
Sourcepub fn new<V: MaybeVersioned>(writer: W) -> AsyncSender<E, W, V>
pub fn new<V: MaybeVersioned>(writer: W) -> AsyncSender<E, 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<E, W, Version>
pub fn versioned<Version: Versioned>( writer: W, version: Version, ) -> AsyncSender<E, 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<E: Into<Error>, W: AsyncWrite<E>, V: MaybeVersioned> AsyncSender<E, W, V>
impl<E: Into<Error>, W: AsyncWrite<E>, V: MaybeVersioned> AsyncSender<E, 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<E: Clone + Into<Error>, W: Clone + AsyncWrite<E>, V: Clone + MaybeVersioned> Clone for AsyncSender<E, W, V>
impl<E: Clone + Into<Error>, W: Clone + AsyncWrite<E>, V: Clone + MaybeVersioned> Clone for AsyncSender<E, W, V>
Source§fn clone(&self) -> AsyncSender<E, W, V>
fn clone(&self) -> AsyncSender<E, W, V>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more