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§
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.