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§
Provided Methods§
Sourcefn match_bytes(bytes: &[u8]) -> Result<(), DescriptorError>
fn match_bytes(bytes: &[u8]) -> Result<(), DescriptorError>
Matches bytes with this descriptor.
On success it returns Ok(()).
On error it returns a DescriptorError.
Sourcefn prepare_bytes(bytes: &mut [u8], len: u8) -> Result<(), DescriptorError>where
Self: WritableDescriptor,
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.