[package]
name = "upc"
description = "USB packet channel (UPC): provides a reliable, packet-based transport over USB."
categories = ["hardware-support", "asynchronous"]
keywords = ["usb", "gadget", "packet", "channel"]
license = "Apache-2.0"
repository = "https://github.com/surban/upc"
authors = ["Sebastian Urban <surban@surban.net>"]
version = "0.10.5"
edition = "2021"
rust-version = "1.85"
autoexamples = false
[features]
default = []
host = ["dep:nusb", "tokio/rt"]
device = ["dep:usb-gadget", "tokio/rt"]
web = ["dep:js-sys", "dep:webusb-web", "dep:wasm-bindgen", "dep:wasm-bindgen-futures", "dep:web-sys", "dep:getrandom"]
cli = ["dep:clap", "dep:tracing-subscriber", "dep:tracing-log", "tokio/io-std", "tokio/io-util"]
trace-packets = []
[dependencies]
futures = "0.3"
tokio = { version = "1.43", features = ["macros", "sync", "time"] }
nusb = { version = "0.2", features = ["tokio"], optional = true }
usb-gadget = { version = "1.1.1", features = ["tokio"], optional = true }
tracing = "0.1"
uuid = "1.13"
bytes = "1.4"
wasm-bindgen-futures = { version = "0.4", optional = true }
js-sys = { version = "0.3", optional = true }
web-sys = { version = "0.3", features = ["Window", "WorkerGlobalScope"], optional = true }
webusb-web = { version = "0.5.1", optional = true }
wasm-bindgen = { version = "0.2", optional = true }
getrandom = { version = "0.4", features = ["wasm_js"], optional = true }
clap = { version = "4", features = ["derive"], optional = true }
tracing-subscriber = { version = "0.3", default-features = false, features = ["env-filter", "fmt"], optional = true }
tracing-log = { version = "0.2", optional = true }
[dev-dependencies]
tokio = { version = "1", features = ["time"] }
tracing-subscriber = { version = "0.3", default-features = false, features = [
"env-filter",
"fmt",
] }
tracing-log = "0.2"
rand = { version = "0.10", features = ["chacha"] }
serial_test = "3"
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tokio = { version = "1", features = ["time", "rt-multi-thread", "signal"] }
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
getrandom = { version = "0.4", features = ["wasm_js"] }
wasm-bindgen-test = "0.3"
web-sys = { version = "0.3", features = ["console", "Document", "HtmlElement"] }
[[bin]]
name = "upc"
required-features = ["cli"]
[[example]]
name = "host"
required-features = ["host"]
doc-scrape-examples = true
[[example]]
name = "device"
required-features = ["device"]
doc-scrape-examples = true
[[example]]
name = "simple_host"
required-features = ["host"]
[[example]]
name = "simple_device"
required-features = ["device"]
[package.metadata.docs.rs]
features = ["host", "device"]
rustdoc-args = ["--cfg", "web_sys_unstable_apis"]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
rustc-args = ["--cfg", "web_sys_unstable_apis"]