Compare commits

..

2 commits

5 changed files with 9 additions and 8 deletions

View file

@ -3,5 +3,5 @@ rustflags = ["--cfg=web_sys_unstable_apis"]
[build] [build]
#just comment in the "current" target #just comment in the "current" target
#target = "x86_64-unknown-linux-gnu" target = "x86_64-unknown-linux-gnu"
target = "wasm32-unknown-unknown" #target = "wasm32-unknown-unknown"

View file

@ -1,6 +1,6 @@
[package] [package]
name = "cross_usb" name = "cross_usb"
version = "0.2.1" version = "0.2.2"
authors = ["G2-Games <ke0bhogsg@gmail.com>"] authors = ["G2-Games <ke0bhogsg@gmail.com>"]
repository = "https://github.com/G2-Games/cross-usb" repository = "https://github.com/G2-Games/cross-usb"
documentation = "https://docs.rs/cross_usb" documentation = "https://docs.rs/cross_usb"

View file

@ -70,7 +70,8 @@ pub async fn get_device(device_filter: Vec<DeviceFilter>) -> Result<UsbDevice, U
result result
}) })
{ {
device_info = Some(prelim_dev_inf) device_info = Some(prelim_dev_inf);
break
} }
} }

View file

@ -1,11 +1,11 @@
//! Cross USB is a USB library which works seamlessly across native and WASM targets. //! Cross USB is a USB library which works seamlessly across native and WASM targets.
//! //!
//! The idea is the user only has to write one way to access USB devices, which can be compiled //! The idea is the user only has to write one way to access USB devices, which can be compiled
//! to both WASM and native targets without any conditional compilation or configuration. //! to both WASM and native targets without any additional conditional compilation or configuration.
//! //!
//! For native device support, this library uses [nusb](https://docs.rs/nusb/latest/nusb/), a cross platform USB library written in Rust //! For native device support, this library uses [nusb](https://docs.rs/nusb/latest/nusb/), a cross platform USB library written in Rust
//! and comparable to the very popular `libusb` C library. Web Assembly support is provided by [web-sys](https://docs.rs/web-sys/latest/web_sys/) //! and comparable to the very popular `libusb` C library. Web Assembly support is provided by [web-sys](https://docs.rs/web-sys/latest/web_sys/)
//! with the [Web USB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API) //! with the [Web USB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API).
//! //!
//! When a [UsbInterface] is dropped, it is automatically released. //! When a [UsbInterface] is dropped, it is automatically released.
//! //!
@ -83,7 +83,7 @@ pub use crate::context::DeviceFilter;
#[doc(inline)] #[doc(inline)]
pub use crate::context::get_device; pub use crate::context::get_device;
/// Macro to create a device filter easily from data. /// Macro to create a device filter more easily.
/// ///
/// The only valid keys are fields of the [DeviceFilter] struct. /// The only valid keys are fields of the [DeviceFilter] struct.
/// You may use as many or as few of them as you need, the rest /// You may use as many or as few of them as you need, the rest

View file

@ -17,7 +17,7 @@ pub trait Device {
async fn open_interface(&self, number: u8) -> Result<UsbInterface, UsbError>; async fn open_interface(&self, number: u8) -> Result<UsbInterface, UsbError>;
/// Reset the device, which causes it to no longer be usable. You must /// Reset the device, which causes it to no longer be usable. You must
/// request a new device with [crate::get_device] or [crate::get_device_filter] /// request a new device with [crate::get_device]
async fn reset(&self) -> Result<(), UsbError>; async fn reset(&self) -> Result<(), UsbError>;
/// Remove the device from the paired devices list, causing it to no longer be usable. You must request to reconnect using [crate::get_device] /// Remove the device from the paired devices list, causing it to no longer be usable. You must request to reconnect using [crate::get_device]