Struct UsbDeviceFilter

Source
#[non_exhaustive]
pub struct UsbDeviceFilter { pub vendor_id: Option<u16>, pub product_id: Option<u16>, pub class_code: Option<u8>, pub subclass_code: Option<u8>, pub protocol_code: Option<u8>, pub serial_number: Option<String>, }
Expand description

A filter used to match specific USB devices by various criteria.

Fields left as None will match any value in that field.

Fields (Non-exhaustive)ยง

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
ยงvendor_id: Option<u16>

Optional USB vendor ID.

ยงproduct_id: Option<u16>

Optional USB product ID.

ยงclass_code: Option<u8>

Optional USB device class code.

ยงsubclass_code: Option<u8>

Optional USB device subclass code.

ยงprotocol_code: Option<u8>

Optional USB device protocol code.

ยงserial_number: Option<String>

Optional USB device serial number.

Implementationsยง

Sourceยง

impl UsbDeviceFilter

Source

pub const fn new() -> Self

Creates a new, empty USB device filter.

Source

pub const fn with_vendor_id(self, vendor_id: u16) -> Self

Filter by vendor id.

Source

pub const fn with_product_id(self, product_id: u16) -> Self

Filter by product id.

Source

pub const fn with_class_code(self, class_code: u8) -> Self

Filter by device class.

Source

pub const fn with_subclass_code(self, subclass_code: u8) -> Self

Filter by device subclass.

Source

pub const fn with_protocol_code(self, protocol_code: u8) -> Self

Filter by device protocol.

Source

pub fn with_serial_number<S: Into<String>>(self, serial_number: S) -> Self

Filter by serial number.

Trait Implementationsยง

Sourceยง

impl Clone for UsbDeviceFilter

Sourceยง

fn clone(&self) -> UsbDeviceFilter

Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยง

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

Performs copy-assignment from source. Read more
Sourceยง

impl Debug for UsbDeviceFilter

Sourceยง

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

Formats the value using the given formatter. Read more
Sourceยง

impl Default for UsbDeviceFilter

Sourceยง

fn default() -> UsbDeviceFilter

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl From<&UsbDeviceFilter> for UsbDeviceFilter

Sourceยง

fn from(value: &UsbDeviceFilter) -> Self

Converts to this type from the input type.

Auto Trait Implementationsยง

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<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.