pub struct Usb { /* private fields */ }
Expand description
WebUSB device enumeration and connection.
Implementations§
Source§impl Usb
impl Usb
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Checks that WebUSB is available and obtains access to the WebUSB API.
Sourcepub fn events(&self) -> UsbEvents
pub fn events(&self) -> UsbEvents
Subscribe to a stream of UsbEvent
s notifying of USB device changes.
Only events for paired devices will be provided.
Sourcepub async fn devices(&self) -> Vec<UsbDevice>
pub async fn devices(&self) -> Vec<UsbDevice>
List of paired attached devices.
For information on pairing devices, see request_device
.
Sourcepub async fn request_device(
&self,
filters: impl IntoIterator<Item = UsbDeviceFilter>,
) -> Result<UsbDevice>
pub async fn request_device( &self, filters: impl IntoIterator<Item = UsbDeviceFilter>, ) -> Result<UsbDevice>
Pairs a USB device with the specified filter criteria.
Calling this function triggers the user agent’s pairing flow.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Usb
impl !RefUnwindSafe for Usb
impl !Send for Usb
impl !Sync for Usb
impl Unpin for Usb
impl !UnwindSafe for Usb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more