capsules_extra::usb::descriptors

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