Trait wasefire_board_api::usb::serial::Api

source ·
pub trait Api: Send {
    // Required methods
    fn read(output: &mut [u8]) -> Result<usize, Error>;
    fn write(input: &[u8]) -> Result<usize, Error>;
    fn flush() -> Result<(), Error>;
    fn enable(event: &Event) -> Result<(), Error>;
    fn disable(event: &Event) -> Result<(), Error>;
}
Available on crate features internal-api-usb and api-usb-serial only.
Expand description

USB serial interface.

Required Methods§

source

fn read(output: &mut [u8]) -> Result<usize, Error>

Reads from the USB serial into a buffer.

Returns the number of bytes read. It could be zero if there’s nothing to read.

source

fn write(input: &[u8]) -> Result<usize, Error>

Writes from a buffer to the USB serial.

Returns the number of bytes written. It could be zero if the other side is not ready.

source

fn flush() -> Result<(), Error>

Flushes the USB serial.

source

fn enable(event: &Event) -> Result<(), Error>

Enables a given event to be triggered.

source

fn disable(event: &Event) -> Result<(), Error>

Disables a given event from being triggered.

Object Safety§

This trait is not object safe.

Implementors§