pub trait Transport: Send + Sync {
// Required methods
fn write(
&mut self,
data: &[u8],
) -> impl Future<Output = Result<(), TransportError>> + Send;
fn read(
&mut self,
buf: &mut [u8],
) -> impl Future<Output = Result<usize, TransportError>> + Send;
fn close(
&mut self,
) -> impl Future<Output = Result<(), TransportError>> + Send;
// Provided method
fn set_baud_rate(&mut self, _baud: u32) -> Result<(), TransportError> { ... }
}Expand description
Async transport for communicating with the radio.
Implemented for USB serial (CDC ACM), Bluetooth SPP (Serial Port Profile), and mock (testing).
Required Methods§
Sourcefn write(
&mut self,
data: &[u8],
) -> impl Future<Output = Result<(), TransportError>> + Send
fn write( &mut self, data: &[u8], ) -> impl Future<Output = Result<(), TransportError>> + Send
Send raw bytes to the radio.
Provided Methods§
Sourcefn set_baud_rate(&mut self, _baud: u32) -> Result<(), TransportError>
fn set_baud_rate(&mut self, _baud: u32) -> Result<(), TransportError>
Change the transport baud rate.
Used when switching between CAT mode (115200 baud over CDC ACM) and programming mode (9600 baud for the entire session). No-op for transports that do not support baud rate changes (e.g., mock).
§Errors
Returns TransportError::Open if the baud rate cannot be applied.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.