[package]
name = "enfync"
description = "Environment-friendly async utilities"
authors = ["koe <ukoe@protonmail.com>"]
version = "0.1.0"
edition = "2021"
keywords = ["async", "wasm", "native"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/UkoeHB/enfync"

[features]
default = ["builtin"]
builtin = []

[lib]
path = "src/lib.rs"
test = false

[[test]]
name    = "test"
path    = "tests/test/mod.rs"
doctest = false

#[target.'cfg(target_family = "wasm")'.lib]  # for some reason this isn't being used... because of [lib]?
#crate-type = ["cdylib", "rlib"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
async-trait = { version = "0.1" }
futures     = { version = "0.3" }

[target.'cfg(not(target_family = "wasm"))'.dependencies]
tokio = { version = "1.29", features = [ "rt-multi-thread", "time" ] }

[target.'cfg(target_family = "wasm")'.dependencies]
gloo-timers          = { version = "0.2", features = [ "futures" ] }
wasm-bindgen         = { version = "0.2" }
wasm-bindgen-futures = { version = "0.4" }

[target.'cfg(target_family = "wasm")'.dev-dependencies]
wasm-bindgen-test = { version = "0.3" }
web-sys           = { version = "0.3", features = [ "console" ] }

[profile.release]
lto           = true
strip         = true    #minimize binary size with symbol stripping
codegen-units = 1       #maximize performance

[profile.release-small]
inherits = "release"
opt-level = "s"
lto = "fat"

[profile.release-small.package."*"]
opt-level = "s"
strip = true

[profile.release-wasm]
inherits = "release-small"
panic    = "abort"

[profile.release-wasm.package."*"]
opt-level = "s"
strip     = true

[profile.dev-wasm]
inherits = "dev"
panic = "abort"
