[][src]Struct usb_device::descriptor::DescriptorWriter

pub struct DescriptorWriter<'a> { /* fields omitted */ }

A writer for USB descriptors.

Implementations

impl<'_> DescriptorWriter<'_>[src]

pub fn position(&self) -> usize[src]

Gets the current position in the buffer, i.e. the number of bytes written so far.

pub fn write(&mut self, descriptor_type: u8, descriptor: &[u8]) -> Result<()>[src]

Writes an arbitrary (usually class-specific) descriptor.

pub fn interface(
    &mut self,
    number: InterfaceNumber,
    interface_class: u8,
    interface_sub_class: u8,
    interface_protocol: u8
) -> Result<()>
[src]

Writes a interface descriptor.

Arguments

  • number - Interface number previously allocated with UsbBusAllocator::interface.
  • interface_class - Class code assigned by USB.org. Use 0xff for vendor-specific devices that do not conform to any class.
  • interface_sub_class - Sub-class code. Depends on class.
  • interface_protocol - Protocol code. Depends on class and sub-class.

pub fn endpoint<'e, B: UsbBus, D: EndpointDirection>(
    &mut self,
    endpoint: &Endpoint<'e, B, D>
) -> Result<()>
[src]

Writes an endpoint descriptor.

Arguments

Auto Trait Implementations

impl<'a> Send for DescriptorWriter<'a>

impl<'a> Sync for DescriptorWriter<'a>

impl<'a> Unpin for DescriptorWriter<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.