embassy-usb-driver

Crates

git

Versions

default

Flavors

UsbHostAllocator

Trait UsbHostAllocator 

Source
pub trait UsbHostAllocator<'d>: Sized + Clone {
    type Pipe<T: Type, D: Direction>: UsbPipe<T, D> + 'd;

    // Required method
    fn alloc_pipe<T: Type, D: Direction>(
        &self,
        addr: u8,
        endpoint: &EndpointInfo,
        split: Option<SplitInfo>,
    ) -> Result<Self::Pipe<T, D>, HostError>;
}
Expand description

Pipe allocator trait for USB host drivers.

Implementations are expected to back allocator state with 'd-lifetime storage (typically statics or user-provided &'d buffers), not with fields on the controller struct.

Required Associated Types§

Source

type Pipe<T: Type, D: Direction>: UsbPipe<T, D> + 'd

Pipe implementation produced by this allocator.

Required Methods§

Source

fn alloc_pipe<T: Type, D: Direction>( &self, addr: u8, endpoint: &EndpointInfo, split: Option<SplitInfo>, ) -> Result<Self::Pipe<T, D>, HostError>

Allocate a pipe for communication with a device endpoint.

This can be a scarce resource; for one-off requests please scope the pipe so that it is dropped after completion.

split — when Some, every transfer on this pipe is routed as a split transaction through the specified hub’s TT (USB 2.0 §11.14), or as a legacy PRE packet on full-speed controllers (USB 1.1 §11.8.6). Pass None when the device is reached directly (host at the same speed as the device, or the device is high-speed).

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§