Skip to main content

EndpointOut

Trait EndpointOut 

pub trait EndpointOut: Endpoint {
    // Required method
    async fn read(&mut self, buf: &mut [u8]) -> Result<usize, EndpointError>;

    // Provided method
    async fn read_transfer(
        &mut self,
        buf: &mut [u8],
    ) -> Result<usize, EndpointError> { ... }
}
Available on crate feature usb only.
Expand description

OUT Endpoint trait.

Required Methods§

async fn read(&mut self, buf: &mut [u8]) -> Result<usize, EndpointError>

Read a single packet of data from the endpoint, and return the actual length of the packet.

This should also clear any NAK flags and prepare the endpoint to receive the next packet.

Provided Methods§

async fn read_transfer( &mut self, buf: &mut [u8], ) -> Result<usize, EndpointError>

Read until the buffer is full or we receive a short packet from the USB host returning the actual length of the entire data block.

This should also clear any NAK flags and prepare the endpoint to receive the next packet or data block.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§