UsbSerial

Trait UsbSerial 

Source
pub trait UsbSerial: SerialPort {
    // Required methods
    fn configure(&mut self, conf: &SerialConfig) -> Result<()>;
    fn into_queues(self) -> (Queue<RequestBuffer>, Queue<Vec<u8>>);
}
Expand description

Serial driver implementations inside this crate should implement this trait.

TODO: add crate-level functions probe() -> Result<Vec<DeviceInfo>, Error> and open(dev_info: &DeviceInfo, timeout: Duration) -> Result<Box<dyn UsbSerial>, Error>.

Required Methods§

Source

fn configure(&mut self, conf: &SerialConfig) -> Result<()>

Sets baudrate, parity check mode, data bits and stop bits.

Source

fn into_queues(self) -> (Queue<RequestBuffer>, Queue<Vec<u8>>)

Takes nusb transfer queues of the read endpoint and the write endpoint. This can be called after serial configuration to do asynchronous operations.

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.

Implementors§