embassy-usb-host

Crates

git

Versions

default

Flavors

FixedSizeDescriptor

Trait FixedSizeDescriptor 

Source
pub trait FixedSizeDescriptor: USBDescriptor {
    const 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

Fixed size descriptor.

Implementors of this trait only allow the correct size while reading or writing.

If you are not sure that the length is always the same, implement ExtendableDescriptor instead.

Required Associated Constants§

Source

const LEN: u8

Length of the descriptor.

This constant is compared against byte 0 of the buffer.

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", so this trait is not object safe.

Implementors§