[package]
name = "commonware-utils"
edition.workspace = true
publish = true
version.workspace = true
license.workspace = true
description = "Leverage common functionality across multiple primitives."
readme = "README.md"
homepage.workspace = true
repository = "https://github.com/commonwarexyz/monorepo/tree/main/utils"
documentation = "https://docs.rs/commonware-utils"

[lints]
workspace = true

[dependencies]
arbitrary = { workspace = true, optional = true, features = ["derive"] }
bytes.workspace = true
cfg-if.workspace = true
commonware-codec = { workspace = true, default-features = false }
futures = { workspace = true, optional = true }
hashbrown.workspace = true
num-bigint = { workspace = true, optional = true }
num-integer = { workspace = true, optional = true }
num-rational = { workspace = true, optional = true }
num-traits = { workspace = true, optional = true }
pin-project.workspace = true
rand.workspace = true
thiserror.workspace = true

[target.'cfg(target_arch = "wasm32")'.dependencies.getrandom]
# Enable "js" feature when WASM is target
version = "0.2.15"
features = ["js"]

[dev-dependencies]
commonware-conformance.workspace = true
criterion.workspace = true
num-bigint = { workspace = true, default-features = false }
rstest.workspace = true

[features]
default = [ "std" ]
std = [
	"bytes/std",
	"commonware-codec/std",
	"futures",
	"getrandom/std",
	"num-bigint",
	"num-bigint?/std",
	"num-integer",
	"num-rational",
	"num-traits",
	"rand/std",
	"rand/std_rng",
	"thiserror/std",
]
arbitrary = [
	"commonware-codec/arbitrary",
	"dep:arbitrary",
	"num-bigint?/arbitrary",
	"std",
]

[lib]
bench = false
crate-type = ["rlib", "cdylib"]

[[bench]]
name = "utils"
harness = false
path = "src/benches/bench.rs"
