embassy-usb-host

Crates

git

Versions

default

Flavors

WritableDescriptor

Trait WritableDescriptor 

Source
pub trait WritableDescriptor: USBDescriptor {
    // Required method
    fn write_to_bytes(&self, bytes: &mut [u8]) -> Result<usize, Self::Error>;

    // Provided method
    fn write_to_bytes_partial(
        &self,
        bytes: &mut [u8],
    ) -> Result<usize, Self::Error> { ... }
}
Expand description

Writable descriptor.

Implementors of this trait can be written to a byte slice.

Required Methods§

Source

fn write_to_bytes(&self, bytes: &mut [u8]) -> Result<usize, Self::Error>

Writes this descriptor to the start of the byte buffer bytes.

The buffer must be big enough to fit all the descriptor data. Use write_to_bytes_partial instead of this method to allow a partial write.

On success, it returns the number of bytes written. On failure, it returns a USBDescriptor::Error.

Provided Methods§

Source

fn write_to_bytes_partial(&self, bytes: &mut [u8]) -> Result<usize, Self::Error>

Writes this descriptor to the start of the byte buffer bytes.

If the buffer is not big enough, only the descriptor data that fits will be written. Use write_to_bytes instead of this method to require a complete write.

On success, it returns the number of bytes written. On failure, it returns a USBDescriptor::Error.

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§