Skip to content

Commit

Permalink
Updated readme and added proper flags to runner
Browse files Browse the repository at this point in the history
  • Loading branch information
G2-Games committed Jul 6, 2024
1 parent 5893774 commit daa2321
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup rust environment
run: rustup target add wasm32-unknown-unknown
- name: Build WASM
run: cargo build --verbose --target wasm32-unknown-unknown
run: RUSTFLAGS=--cfg=web_sys_unstable_apis cargo build --verbose --target wasm32-unknown-unknown
- name: Build Native (Linux)
run: cargo build --verbose --target x86_64-unknown-linux-gnu
- name: Run clippy
Expand Down
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# Cross USB
[![Lib.rs Version](https://img.shields.io/crates/v/cross_usb?style=for-the-badge&logo=rust&label=lib.rs&color=%23a68bfc)](https://lib.rs/crates/cross_usb)
[![docs.rs](https://img.shields.io/docsrs/cross_usb?style=for-the-badge)](https://docs.rs/cross_usb/)

A USB library which works seamlessly across most native and WASM targets.

[Crates.io](https://crates.io/crates/cross_usb)

[Documentation](https://docs.rs/cross_usb/)

------------------

> [!NOTE]
> [!NOTE]
> Web USB only works in Chromium based browsers for now.
> [!NOTE]
> Web USB has certain interation requirements in browsers, along with requiring
> a **Secure context**. Please read more about this on the
> [mdn web docs](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API)
> [!IMPORTANT]
> When compiling this crate on a WASM target, you must use either
> `RUSTFLAGS=--cfg=web_sys_unstable_apis` or by passing the argument in a
> `.cargo/config.toml` file. Read more here: https://rustwasm.github.io/wasm-bindgen/web-sys/unstable-apis.html
## Dependencies

For native USB, the crate utilizies [nusb](https://github.com/kevinmehall/nusb), a pure rust library similar to the very popular libusb.
Expand All @@ -21,4 +29,4 @@ For WASM, this crate utilizes [web-sys](https://crates.io/crates/web-sys) which

- [ ] Add choice for native backend between `libusb` wrapper and pure rust `nusb`
- [ ] Allow platform-specific operations if the user requires them
- [ ] Hot plug support... requires either using `libusb` as an optional backend or for [`nusb` to implement it](https://github.com/kevinmehall/nusb/issues/5)
- [ ] Hot plug support... requires either using `libusb` as an optional backend or for [`nusb` to implement it](https://github.com/kevinmehall/nusb/issues/5)

0 comments on commit daa2321

Please sign in to comment.