pub struct DescriptorChain<'a, T> {
pub descriptor: T,
pub buffer: &'a [u8],
}Expand description
A chain of descriptors.
Holds the current descriptor and a reference to the bytes after the descriptor. Deferences to the descriptor.
Fields§
§descriptor: TThe current descriptor.
buffer: &'a [u8]The raw bytes following the descriptor.
Implementations§
Source§impl<'a> DescriptorChain<'a, ConfigurationDescriptor>
impl<'a> DescriptorChain<'a, ConfigurationDescriptor>
Sourcepub fn try_from_slice(buf: &'a [u8]) -> Result<Self, HostError>
pub fn try_from_slice(buf: &'a [u8]) -> Result<Self, HostError>
Parse a full Configuration Descriptor blob, giving access to sub-descriptors via iterators.
Sourcepub fn iter_descriptors(&self) -> RawDescriptorIterator<'a> ⓘ
pub fn iter_descriptors(&self) -> RawDescriptorIterator<'a> ⓘ
Iterate over all raw descriptors in this Configuration.
Sourcepub fn iter_interface(&self) -> InterfaceIterator<'_> ⓘ
pub fn iter_interface(&self) -> InterfaceIterator<'_> ⓘ
Iterate over all interface descriptors of this Configuration.
Sourcepub fn find_interface<C: ClassMatch>(
&'a self,
) -> Option<InterfaceDescriptorChain<'a>>
pub fn find_interface<C: ClassMatch>( &'a self, ) -> Option<InterfaceDescriptorChain<'a>>
Find the first interface matching C.
Sourcepub fn find_interfaces<C: ClassMatch>(
&'a self,
) -> impl Iterator<Item = InterfaceDescriptorChain<'a>> + 'a
pub fn find_interfaces<C: ClassMatch>( &'a self, ) -> impl Iterator<Item = InterfaceDescriptorChain<'a>> + 'a
Iterate over every interface matching C.
Sourcepub fn find_iad_group(
&'a self,
interface: u8,
) -> Option<InterfaceAssociationDescriptor>
pub fn find_iad_group( &'a self, interface: u8, ) -> Option<InterfaceAssociationDescriptor>
Find the Interface Association Descriptor whose interface group contains
interface.
Returns None when the configuration has no matching IAD, or when the
interface is not part of an association.
Sourcepub fn visit_descriptors<V: DescriptorVisitor<'a>>(
&self,
visitor: &mut V,
) -> Result<(), VisitError<V::Error>>
pub fn visit_descriptors<V: DescriptorVisitor<'a>>( &self, visitor: &mut V, ) -> Result<(), VisitError<V::Error>>
Iterate over all descriptors of this Configuration, passing to Visitor callbacks.
Returns Ok(()) on completion (including early stop), or Err(e) on error.
Source§impl<'a> DescriptorChain<'a, InterfaceDescriptor>
impl<'a> DescriptorChain<'a, InterfaceDescriptor>
Sourcepub fn iter_descriptors(&self) -> RawDescriptorIterator<'_> ⓘ
pub fn iter_descriptors(&self) -> RawDescriptorIterator<'_> ⓘ
Iterate over raw descriptors inside this interface.
Sourcepub fn iter_endpoints(&'a self) -> EndpointIterator<'a> ⓘ
pub fn iter_endpoints(&'a self) -> EndpointIterator<'a> ⓘ
Iterate over endpoint descriptors inside this interface.
Trait Implementations§
Source§impl<'a, T: Clone> Clone for DescriptorChain<'a, T>
impl<'a, T: Clone> Clone for DescriptorChain<'a, T>
impl<T> Copy for DescriptorChain<'_, T>where
T: Copy,
Source§impl<'a, T: Debug> Debug for DescriptorChain<'a, T>
impl<'a, T: Debug> Debug for DescriptorChain<'a, T>
Source§impl<'a, T> Deref for DescriptorChain<'a, T>
impl<'a, T> Deref for DescriptorChain<'a, T>
Source§impl<'a, T> DerefMut for DescriptorChain<'a, T>
impl<'a, T> DerefMut for DescriptorChain<'a, T>
impl<'a, T: Eq> Eq for DescriptorChain<'a, T>
Source§impl<T> Format for DescriptorChain<'_, T>where
T: Format,
Available on crate feature defmt only.
impl<T> Format for DescriptorChain<'_, T>where
T: Format,
defmt only.