Skip to main content

UsbTransfer

Trait UsbTransfer 

Source
pub trait UsbTransfer: Send + Sync {
    // Required methods
    fn bulk_write(
        &self,
        endpoint: u8,
        data: &[u8],
        timeout: Duration,
    ) -> Result<usize, U3vError>;
    fn bulk_read(
        &self,
        endpoint: u8,
        buf: &mut [u8],
        timeout: Duration,
    ) -> Result<usize, U3vError>;
}
Expand description

Abstraction over a claimed USB device for bulk endpoint I/O.

Implementations must be safe to share across threads. The control and stream channels use different endpoints, so a single UsbTransfer can serve both concurrently (with internal synchronization if needed).

Required Methods§

Source

fn bulk_write( &self, endpoint: u8, data: &[u8], timeout: Duration, ) -> Result<usize, U3vError>

Write data to the bulk OUT endpoint. Returns bytes written.

Source

fn bulk_read( &self, endpoint: u8, buf: &mut [u8], timeout: Duration, ) -> Result<usize, U3vError>

Read up to buf.len() bytes from the bulk IN endpoint. Returns the number of bytes actually read.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§