Struct nusb::descriptors::Configuration
source · pub struct Configuration<'a>(/* private fields */);
Expand description
Information about a USB configuration with access to all associated interfaces, endpoints, and other descriptors.
Implementations§
source§impl<'a> Configuration<'a>
impl<'a> Configuration<'a>
sourcepub fn new(buf: &[u8]) -> Configuration<'_>
pub fn new(buf: &[u8]) -> Configuration<'_>
Create a Configuration
from a buffer containing a series of descriptors.
You normally obtain a Configuration
from a Device
, but this allows creating
one from your own descriptor bytes for tests.
§Panics
- when the buffer is too short for a configuration descriptor
- when the bLength and wTotalLength fields are longer than the buffer
- when the first descriptor is not a configuration descriptor
sourcepub fn descriptors(&self) -> Descriptors<'_> ⓘ
pub fn descriptors(&self) -> Descriptors<'_> ⓘ
Get the configuration descriptor followed by all trailing interface and other descriptors.
sourcepub fn interface_alt_settings(
&self
) -> impl Iterator<Item = InterfaceAltSetting<'_>>
pub fn interface_alt_settings( &self ) -> impl Iterator<Item = InterfaceAltSetting<'_>>
Iterate all interfaces and alternate settings settings of this configuration.
sourcepub fn interfaces(&self) -> impl Iterator<Item = InterfaceGroup<'_>>
pub fn interfaces(&self) -> impl Iterator<Item = InterfaceGroup<'_>>
Iterate the interfaces of this configuration, grouping together alternate settings of the same interface.
source§impl<'a> Configuration<'a>
impl<'a> Configuration<'a>
sourcepub fn num_interfaces(&self) -> u8
pub fn num_interfaces(&self) -> u8
bNumInterfaces
descriptor field: Number of interfaces.
sourcepub fn configuration_value(&self) -> u8
pub fn configuration_value(&self) -> u8
bConfigurationValue
descriptor field: Identifier for the configuration.
Pass this value to
Device::set_configuration
to
select this configuration.
sourcepub fn attributes(&self) -> u8
pub fn attributes(&self) -> u8
bmAttributes
descriptor field: Bitmap of configuration attributes.
source§impl<'a> Configuration<'a>
impl<'a> Configuration<'a>
sourcepub fn string_index(&self) -> Option<u8>
pub fn string_index(&self) -> Option<u8>
Index of the string descriptor describing this configuration.
Trait Implementations§
source§impl<'a> Clone for Configuration<'a>
impl<'a> Clone for Configuration<'a>
source§fn clone(&self) -> Configuration<'a>
fn clone(&self) -> Configuration<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more