pub trait DescriptorVisitor<'a> {
type Error;
// Provided methods
fn on_configuration(&mut self, _c: &ConfigurationDescriptor<'a>) -> bool { ... }
fn on_interface(&mut self, _i: &InterfaceDescriptor<'a>) -> bool { ... }
fn on_endpoint(
&mut self,
_iface: &InterfaceDescriptor<'a>,
_e: &EndpointDescriptor,
) -> bool { ... }
fn on_other(
&mut self,
_iface: Option<&InterfaceDescriptor<'a>>,
_raw: &[u8],
) -> Result<bool, Self::Error> { ... }
}Expand description
Callback-based visitor for a configuration’s descriptor tree.
Implement only the methods you care about.
Required Associated Types§
Provided Methods§
Sourcefn on_configuration(&mut self, _c: &ConfigurationDescriptor<'a>) -> bool
fn on_configuration(&mut self, _c: &ConfigurationDescriptor<'a>) -> bool
Return false to stop iteration early
Sourcefn on_interface(&mut self, _i: &InterfaceDescriptor<'a>) -> bool
fn on_interface(&mut self, _i: &InterfaceDescriptor<'a>) -> bool
Return false to stop iteration early
Sourcefn on_endpoint(
&mut self,
_iface: &InterfaceDescriptor<'a>,
_e: &EndpointDescriptor,
) -> bool
fn on_endpoint( &mut self, _iface: &InterfaceDescriptor<'a>, _e: &EndpointDescriptor, ) -> bool
Return false to stop iteration early
Sourcefn on_other(
&mut self,
_iface: Option<&InterfaceDescriptor<'a>>,
_raw: &[u8],
) -> Result<bool, Self::Error>
fn on_other( &mut self, _iface: Option<&InterfaceDescriptor<'a>>, _raw: &[u8], ) -> Result<bool, Self::Error>
Catches every sub-descriptor that isn’t an interface or endpoint:
CS_INTERFACE, CS_ENDPOINT, HID, vendor-specific, etc.
Return Ok(false) to stop iteration early without an error, or Err(e) to stop with one.