Skip to main content

ByteLink

Trait ByteLink 

Source
pub trait ByteLink {
    // Required methods
    fn read(&mut self, buf: &mut [u8]) -> impl Future<Output = Result<usize>>;
    fn write_all(&mut self, data: &[u8]) -> impl Future<Output = Result<()>>;
}
Expand description

A bidirectional byte stream: the seam a MAVLink Connection moves frames over.

Implemented here by MemoryLink for hardware-free testing; a serial port or UDP socket implements the same two methods to carry MAVLink over real links.

Required Methods§

Source

fn read(&mut self, buf: &mut [u8]) -> impl Future<Output = Result<usize>>

Reads available bytes into buf, returning how many were read.

§Arguments
  • buf - the destination for the bytes read.
§Returns

The number of bytes read; 0 means the link has no more input.

§Errors

Returns a MavlinkError if the underlying link fails.

Source

fn write_all(&mut self, data: &[u8]) -> impl Future<Output = Result<()>>

Writes all of data to the link.

§Arguments
  • data - the bytes to write.
§Returns

Ok(()) once every byte has been handed to the link.

§Errors

Returns a MavlinkError if the underlying link fails.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§