Trait capsules_extra::usb::descriptors::Descriptor

source ·
pub trait Descriptor {
    // Required methods
    fn size(&self) -> usize;
    fn write_to_unchecked(&self, buf: &[Cell<u8>]) -> usize;

    // Provided method
    fn write_to(&self, buf: &[Cell<u8>]) -> usize { ... }
}

Required Methods§

source

fn size(&self) -> usize

Serialized size of Descriptor

source

fn write_to_unchecked(&self, buf: &[Cell<u8>]) -> usize

Same as write_to(), but doesn’t check that buf is long enough before indexing into it. This should be used only if the result of size() is first consulted.

Provided Methods§

source

fn write_to(&self, buf: &[Cell<u8>]) -> usize

Serialize the descriptor to a buffer for transmission on the bus

Implementors§