embassy-usb-host

Crates

git

Versions

default

Flavors

DescriptorChain

Struct DescriptorChain 

Source
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: T

The current descriptor.

§buffer: &'a [u8]

The raw bytes following the descriptor.

Implementations§

Source§

impl<'a> DescriptorChain<'a, ConfigurationDescriptor>

Source

pub fn try_from_slice(buf: &'a [u8]) -> Result<Self, HostError>

Parse a full Configuration Descriptor blob, giving access to sub-descriptors via iterators.

Source

pub fn iter_descriptors(&self) -> RawDescriptorIterator<'a>

Iterate over all raw descriptors in this Configuration.

Source

pub fn iter_interface(&self) -> InterfaceIterator<'_>

Iterate over all interface descriptors of this Configuration.

Source

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>

Source

pub fn iter_descriptors(&self) -> RawDescriptorIterator<'_>

Iterate over raw descriptors inside this interface.

Source

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>

Source§

fn clone(&self) -> DescriptorChain<'a, T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, T: Debug> Debug for DescriptorChain<'a, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, T> Deref for DescriptorChain<'a, T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<'a, T> DerefMut for DescriptorChain<'a, T>

Source§

fn deref_mut(&mut self) -> &mut T

Mutably dereferences the value.
Source§

impl<T> Format for DescriptorChain<'_, T>
where T: Format,

Available on crate feature defmt only.
Source§

fn format(&self, fmt: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl<'a> From<&DescriptorChain<'a, InterfaceDescriptor>> for InterfaceDescriptor

Source§

fn from(chain: &InterfaceDescriptorChain<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: PartialEq> PartialEq for DescriptorChain<'a, T>

Source§

fn eq(&self, other: &DescriptorChain<'a, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Copy for DescriptorChain<'_, T>
where T: Copy,

Source§

impl<'a, T: Eq> Eq for DescriptorChain<'a, T>

Source§

impl<'a, T> StructuralPartialEq for DescriptorChain<'a, T>

Auto Trait Implementations§

§

impl<'a, T> Freeze for DescriptorChain<'a, T>
where T: Freeze,

§

impl<'a, T> RefUnwindSafe for DescriptorChain<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for DescriptorChain<'a, T>
where T: Send,

§

impl<'a, T> Sync for DescriptorChain<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for DescriptorChain<'a, T>
where T: Unpin,

§

impl<'a, T> UnwindSafe for DescriptorChain<'a, T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.