embassy-usb-host

Crates

git

Versions

default

Flavors

Skip to main content

ExtendableDescriptor

Trait ExtendableDescriptor 

Source
pub trait ExtendableDescriptor: USBDescriptor {
    const MIN_LEN: u8;

    // Provided methods
    fn match_bytes(bytes: &[u8]) -> Result<(), DescriptorError> { ... }
    fn prepare_bytes(bytes: &mut [u8], len: u8) -> Result<(), DescriptorError>
       where Self: WritableDescriptor { ... }
}
Expand description

Extendable fixed size descriptor.

Implementors of this trait allow extra bytes in the descriptor while reading or writing. The origin and purpose of the extra bytes is undefined, it might be a class extension, a vendor extension, or anything else.

Required Associated Constants§

Source

const MIN_LEN: u8

Minimum length of the descriptor.

This value is compared against byte 0 of the buffer. All bytes after this length are considered an extension of the descriptor.

Provided Methods§

Source

fn match_bytes(bytes: &[u8]) -> Result<(), DescriptorError>

Matches bytes with this descriptor.

On success it returns Ok(()). On error it returns a DescriptorError.

Source

fn prepare_bytes(bytes: &mut [u8], len: u8) -> Result<(), DescriptorError>
where Self: WritableDescriptor,

Prepares bytes to receive descriptor data.

Fills in the descriptor length and type, and zeroes the rest.

On success, it returns Ok(()). On error, it returns a DescriptorError.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl ExtendableDescriptor for AudioControlHeaderDescriptor

Source§

const MIN_LEN: u8 = 9

Source§

impl ExtendableDescriptor for AudioEndpointDescriptor

Source§

const MIN_LEN: u8 = 8

Source§

impl ExtendableDescriptor for AudioStreamingClassDescriptor

Source§

const MIN_LEN: u8 = 16

Source§

impl ExtendableDescriptor for ClockDescriptor

Source§

const MIN_LEN: u8 = 3

Source§

impl ExtendableDescriptor for ClockMultiplierDescriptor

Source§

const MIN_LEN: u8 = 7

Source§

impl ExtendableDescriptor for ClockSourceDescriptor

Source§

const MIN_LEN: u8 = 8

Source§

impl ExtendableDescriptor for ConfigurationDescriptor

Source§

const MIN_LEN: u8 = 9

Source§

impl ExtendableDescriptor for DeviceDescriptor

Source§

const MIN_LEN: u8 = 18

Source§

impl ExtendableDescriptor for DeviceDescriptorPartial

Source§

const MIN_LEN: u8 = 8

Source§

impl ExtendableDescriptor for EndpointDescriptor

Source§

const MIN_LEN: u8 = 7

Source§

impl ExtendableDescriptor for FormatTypeDescriptor

Source§

const MIN_LEN: u8 = 4

Source§

impl ExtendableDescriptor for InputTerminalDescriptor

Source§

const MIN_LEN: u8 = 17

Source§

impl ExtendableDescriptor for InterfaceAssociationDescriptor

Source§

const MIN_LEN: u8 = 8

Source§

impl ExtendableDescriptor for InterfaceDescriptor

Source§

const MIN_LEN: u8 = 9

Source§

impl ExtendableDescriptor for OutputTerminalDescriptor

Source§

const MIN_LEN: u8 = 12

Source§

impl ExtendableDescriptor for TerminalDescriptor

Source§

const MIN_LEN: u8 = 3

Source§

impl ExtendableDescriptor for UnitDescriptor

Source§

const MIN_LEN: u8 = 4