pub struct AsyncReceiver<E: Into<Error>, R: AsyncRead<E>, V: MaybeVersioned> { /* private fields */ }
Expand description
Receives MAVLink frames asynchronously.
Receives MAVLink frames from an instance of AsyncRead
.
Implementations§
Source§impl<E: Into<Error>, R: AsyncRead<E>> AsyncReceiver<E, R, Versionless>
impl<E: Into<Error>, R: AsyncRead<E>> AsyncReceiver<E, R, Versionless>
Sourcepub fn new<V: MaybeVersioned>(reader: R) -> AsyncReceiver<E, R, V>
pub fn new<V: MaybeVersioned>(reader: R) -> AsyncReceiver<E, R, V>
Default constructor.
Sourcepub fn versionless(reader: R) -> Self
pub fn versionless(reader: R) -> Self
Create a MAVLink version agnostic receiver.
Creates a protocol-agnostic receiver which will look up for both MAVLink 1
and MAVLink 2
frames.
If you want a receiver restricted to a specific MAVLink protocol version, use
AsyncReceiver::versioned
.
If you want to instantiate a generic receiver, use AsyncReceiver::new
.
Sourcepub fn versioned<Version: Versioned>(
reader: R,
version: Version,
) -> AsyncReceiver<E, R, Version>
pub fn versioned<Version: Versioned>( reader: R, version: Version, ) -> AsyncReceiver<E, R, Version>
Create a receiver specific to a particular MAVLink protocol version.
Same as AsyncReceiver::new::<V1>
/ AsyncReceiver::new::<V2>
but with an explicit
version
marker as a parameter.
Since versioned receiver will look up for MAVLink frames starting with a specific
MavSTX
magic byte, it may behave incorrectly, if the incoming
stream contains frames of a different protocol version. If this is the case, it is preferred
to construct versionless receiver by AsyncReceiver::new
and then attempt to convert incoming
frames into a specific protocol version with Frame::try_into_versioned
.
Source§impl<E: Into<Error>, R: AsyncRead<E>, V: MaybeVersioned> AsyncReceiver<E, R, V>
impl<E: Into<Error>, R: AsyncRead<E>, V: MaybeVersioned> AsyncReceiver<E, R, V>
Trait Implementations§
Source§impl<E: Clone + Into<Error>, R: Clone + AsyncRead<E>, V: Clone + MaybeVersioned> Clone for AsyncReceiver<E, R, V>
impl<E: Clone + Into<Error>, R: Clone + AsyncRead<E>, V: Clone + MaybeVersioned> Clone for AsyncReceiver<E, R, V>
Source§fn clone(&self) -> AsyncReceiver<E, R, V>
fn clone(&self) -> AsyncReceiver<E, R, V>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more