Expand description
§Basic MAVLink I/O
This module includes basic MAVLink I/O utils for reading and writing frames
(MavLinkFrame
).
§Targets
For std
environments mavio
uses
std::io::Read
and std::io::Write
reader and writer.
For no_std
mavio
uses custom Read
and Write
traits:
use mavio::error::Result;
trait Read {
fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>;
}
trait Write {
fn write(&mut self, buf: &[u8]) -> Result<usize>;
fn write_all(&mut self, buf: &[u8]) -> Result<()>;
}
In addition, the following IoError
error is defined for no_std
:
#[derive(Clone, Debug)]
pub enum IoError {
/// Operation was interrupted.
///
/// In most cases this means that operation can be retried.
Interrupted,
/// Invalid data received.
InvalidData,
/// This operation is unsupported.
Unsupported,
/// Unexpected end-of-file.
///
/// In most cases this means that smaller amount of bytes are available.
UnexpectedEof,
/// Other error.
Other(String),
}
This error will be wrapped with no_std
version of Error
.
Structs§
- Receives MAVLink frames asynchronously.
- Sends MAVLink frames asynchronously.
- Receives MAVLink frames.
- Sends MAVLink frames.