[package]
name = "mbus-serial"
version = "0.13.0"
edition.workspace = true
authors.workspace = true
license-file = "LICENSE"
repository.workspace = true
homepage.workspace = true
readme = "README.md"
keywords.workspace = true
categories.workspace = true
description = "Serial RTU and ASCII transport implementations for modbus-rs, including sync, Tokio, and WASM adapters"

[dependencies]
mbus-core = { workspace = true }

heapless = { workspace = true }
log = { workspace = true, optional = true }
gloo-timers = { version = "0.3", features = ["futures"], optional = true }
js-sys = { version = "0.3", optional = true }
wasm-bindgen = { version = "0.2", optional = true }
wasm-bindgen-futures = { version = "0.4", optional = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
serialport = { version = "4.2.2", default-features = false, optional = true }
tokio = { version = "1", features = ["io-util", "time"], optional = true }
tokio-serial = { version = "5", optional = true, default-features = false }

[features]
default = ["serial-client", "serial-server"]
logging = ["dep:log"]

# Symmetrical Serial Transports
serial-client = ["dep:serialport"]
serial-server = ["dep:serialport"]
serial-async = ["dep:tokio", "dep:tokio-serial", "mbus-core/async"]

serial-wasm = [
    "dep:gloo-timers",
    "dep:js-sys",
    "dep:wasm-bindgen",
    "dep:wasm-bindgen-futures",
]

# Backward-Compatibility / Legacy Aliases
async = ["serial-async"]
wasm = ["serial-wasm"]
