Crate webusb_web

Source
Expand description

WebUSB on the web 🕸️ — Access USB devices from the web browser.

The WebUSB API provides a way to expose non-standard Universal Serial Bus (USB) compatible devices services to the web, to make USB safer and easier to use.

This crate provides Rust support for using WebUSB when targeting WebAssembly.

MDN provides a WebUSB overview while detailed information is available in the WebUSB specification.

§Building

This crate depends on unstable features of the web_sys crate. Therefore you must add --cfg=web_sys_unstable_apis to the Rust compiler flags (RUSTFLAGS).

§Usage

Call Usb::new() to obtain an interface to the WebUSB API. You must call Usb::request_device() to ask the user for permission before any USB device can be used through this API.

Structs§

Error
WebUSB error.
OpenUsbDevice
An opened USB device.
Usb
WebUSB device enumeration and connection.
UsbAlternateInterface
An alternate setting containing detailed interface information.
UsbConfiguration
A configuration belonging to a USB device.
UsbControlRequest
USB control request.
UsbDevice
A USB device.
UsbDeviceFilter
A filter used to match specific USB devices by various criteria.
UsbEndpoint
A USB endpoint provided by the USB device.
UsbEvents
WebUSB event stream.
UsbInterface
A USB interface grouping one or more alternate settings.

Enums§

ErrorKind
WebUSB error kind.
UsbDirection
USB transfer direction.
UsbEndpointType
USB endpoint type.
UsbEvent
WebUSB event.
UsbRecipient
The recipient of a USB control transfer.
UsbRequestType
The type of USB control request.

Type Aliases§

Result
WebUSB result.