Struct usb_device::descriptor::DescriptorWriter
source · pub struct DescriptorWriter<'a> { /* private fields */ }
Expand description
A writer for USB descriptors.
Implementations
sourceimpl DescriptorWriter<'_>
impl DescriptorWriter<'_>
sourcepub fn position(&self) -> usize
pub fn position(&self) -> usize
Gets the current position in the buffer, i.e. the number of bytes written so far.
sourcepub fn write(&mut self, descriptor_type: u8, descriptor: &[u8]) -> Result<()>
pub fn write(&mut self, descriptor_type: u8, descriptor: &[u8]) -> Result<()>
Writes an arbitrary (usually class-specific) descriptor.
sourcepub fn interface(
&mut self,
number: InterfaceNumber,
interface_class: u8,
interface_sub_class: u8,
interface_protocol: u8
) -> Result<()>
pub fn interface(
&mut self,
number: InterfaceNumber,
interface_class: u8,
interface_sub_class: u8,
interface_protocol: u8
) -> Result<()>
Writes a interface descriptor.
Arguments
number
- Interface number previously allocated withUsbBusAllocator::interface
.interface_class
- Class code assigned by USB.org. Use0xff
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.
sourcepub fn endpoint<'e, B: UsbBus, D: EndpointDirection>(
&mut self,
endpoint: &Endpoint<'e, B, D>
) -> Result<()>
pub fn endpoint<'e, B: UsbBus, D: EndpointDirection>(
&mut self,
endpoint: &Endpoint<'e, B, D>
) -> Result<()>
Writes an endpoint descriptor.
Arguments
endpoint
- Endpoint previously allocated withUsbBusAllocator
.
Auto Trait Implementations
impl<'a> RefUnwindSafe for DescriptorWriter<'a>
impl<'a> Send for DescriptorWriter<'a>
impl<'a> Sync for DescriptorWriter<'a>
impl<'a> Unpin for DescriptorWriter<'a>
impl<'a> !UnwindSafe for DescriptorWriter<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more