postcard-rpc 0.11.7

A no_std + serde compatible RPC library for Rust
Documentation
[package]
name = "postcard-rpc"
version = "0.11.7"
authors = ["James Munns <james@onevariable.com>"]
edition = "2021"
repository = "https://github.com/jamesmunns/postcard-rpc"
description = "A no_std + serde compatible RPC library for Rust"
license = "MIT OR Apache-2.0"
categories = ["embedded", "no-std"]
keywords = ["serde", "cobs", "framing"]
documentation = "https://docs.rs/postcard-rpc/"
readme = "../../README.md"

[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "doc_cfg"]
features = [
    "test-utils",
    "use-std",
    "cobs-serial",
    "raw-nusb",
    "embassy-usb-0_3-server",
    "_docs-fix",
    # TODO: What to do about the webusb feature? Can we do separate target builds?
]

[dependencies]
cobs = { version = "0.2.3", optional = true, default-features = false }
defmt = { version = "0.3.5", optional = true }
heapless = "0.8.0"
postcard = { version = "1.0.10" }
serde = { version = "1.0.192", default-features = false, features = ["derive"] }
postcard-schema = { version = "0.2.1", features = ["derive"] }

#
# std-only features
#

[dependencies.nusb]
version = "0.1"
optional = true

[dependencies.tokio-serial]
version = "5.4.4"
optional = true

[dependencies.maitake-sync]
version = "0.1.2"
optional = true

[dependencies.tokio]
version = "1.33.0"
features = ["sync", "rt", "macros", "io-util", "time"]
optional = true

[dependencies.tracing]
version = "0.1"
optional = true

[dependencies.js-sys]
version = "0.3.69"
optional = true

[dependencies.thiserror]
version = "1.0"
optional = true

[dependencies.web-sys]

version = "0.3.69"
optional = true
features = [
    "Element",
    "Navigator",
    'Usb',
    'UsbDeviceRequestOptions',
    'UsbDevice',
    'UsbInTransferResult',
    'UsbControlTransferParameters',
    'UsbOutTransferResult',
    'UsbRecipient',
    'UsbRequestType',
    "UsbTransferStatus",
]

[dependencies.gloo]
version = "0.11.0"
optional = true

[dependencies.serde_json]
version = "1.0"
optional = true

[dependencies.wasm-bindgen]
version = "0.2.92"
optional = true

[dependencies.wasm-bindgen-futures]
version = "0.4.42"
optional = true

[dependencies.trait-variant]
version = "0.1.2"
optional = true


#
# no_std-only features
#

[dependencies.embassy-usb-0_3]
package = "embassy-usb"
version = "0.3"
optional = true

[dependencies.embassy-usb-0_4]
package = "embassy-usb"
version = "0.4"
optional = true

[dependencies.embassy-usb-driver]
version = "0.1"
optional = true

[dependencies.embassy-sync]
version = "0.6"
optional = true

[dependencies.static_cell]
version = "2.1"
optional = true

[dependencies.embassy-executor]
version = "0.7"
optional = true

[dependencies.embassy-futures]
version = "0.1"
optional = true

[dependencies.embassy-time]
version = "0.4"
optional = true

[dependencies.portable-atomic]
version = "1.0"
default-features = false

[dev-dependencies]
postcard-rpc = { path = "../postcard-rpc", features = ["test-utils"] }

#
# Hack features (see below)
#
[dependencies.ssmarshal]
version = "1.0"
optional = true
features = ["std"]


[features]
default = []
test-utils = ["use-std", "postcard-schema/use-std"]
use-std = [
    "dep:maitake-sync",
    "dep:tokio",
    "postcard/use-std",
    "postcard-schema/use-std",
    "dep:thiserror",
    "dep:tracing",
    "dep:trait-variant",
    "dep:ssmarshal",
]

# Cobs Serial support.
#
# Works on: Win, Mac, Linux
# Does NOT work on: WASM
cobs-serial = ["cobs/use_std", "dep:tokio-serial"]

# Raw (bulk) USB support
#
# Works on: Win, Mac, Linux
# Does NOT work on: WASM
raw-nusb = ["dep:nusb", "use-std"]

# WebUSB support
#
# Works on: WASM
# Does NOT work on: Win, Mac, Linux
#
# NOTE: Requires the following in your `.cargo/config.toml`, or otherwise
# activated via RUSTFLAGS:
#
# ```toml
# [target.wasm32-unknown-unknown]
# rustflags = "--cfg=web_sys_unstable_apis"
# ```
webusb = [
    "dep:gloo",
    "dep:web-sys",
    "dep:serde_json",
    "dep:wasm-bindgen",
    "dep:wasm-bindgen-futures",
    "dep:js-sys",
    "use-std",
]
embassy-usb-0_3-server = [
    "dep:embassy-usb-0_3",
    "dep:embassy-sync",
    "dep:static_cell",
    "dep:embassy-usb-driver",
    "dep:embassy-executor",
    "dep:embassy-time",
    "dep:embassy-futures",
]

embassy-usb-0_4-server = [
    "dep:embassy-usb-0_4",
    "dep:embassy-sync",
    "dep:static_cell",
    "dep:embassy-usb-driver",
    "dep:embassy-executor",
    "dep:embassy-time",
    "dep:embassy-futures",
]

# NOTE: This exists because `embassy-usb` indirectly relies on ssmarshal
# which doesn't work on `std` builds without the `std` feature. This causes
# `cargo doc --all-features` (and docs.rs builds) to fail. Sneakily re-activate
# that feature when `--all-features` is set. This feature is considered unstable
# and should not be relied upon.
_docs-fix = ["dep:ssmarshal"]