pub struct Sender<W: Write, V: MaybeVersioned> { /* private fields */ }
Expand description
Sends MAVLink frames.
Sends MAVLink frames to an instance of Write
.
Implementations§
source§impl<W: Write> Sender<W, Versionless>
impl<W: Write> Sender<W, Versionless>
sourcepub fn new<V: MaybeVersioned>(writer: W) -> Sender<W, V>
pub fn new<V: MaybeVersioned>(writer: W) -> Sender<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 Sender::versioned
.
If you want to instantiate a generic sender, use Sender::new
.
sourcepub fn versioned<Version: Versioned>(
writer: W,
version: Version
) -> Sender<W, Version>
pub fn versioned<Version: Versioned>( writer: W, version: Version ) -> Sender<W, Version>
Create a receiver specific to a particular MAVLink protocol version.
Same as Sender::new::<V1>
/ Sender::new::<V2>
but with an explicit version
marker as parameter.
If you want to send both MAVLink 1
and MAVLink 2
frames, use Sender::versionless
.
source§impl<W: Write, V: MaybeVersioned> Sender<W, V>
impl<W: Write, V: MaybeVersioned> Sender<W, V>
sourcepub fn send(&mut self, frame: &Frame<V>) -> Result<usize>
pub fn send(&mut self, frame: &Frame<V>) -> Result<usize>
Sends MAVLink Frame
.
Blocks until all bytes written and returns the number of bytes sent.
Versioned
sender accepts only frames of a specific MAVLink protocol version.
Versionless
sender accepts both MAVLink 1
and MAVLink 2
frames as
Frame<Versionless>
.