[package]
name = "hannibal"
version = "0.14.2"
authors = ["Hendrik Sollich <hendrik@hoodie.de>"]
license = "MIT/Apache-2.0"

description = "A small actor library"
documentation = "https://docs.rs/hannibal/"
repository = "https://github.com/hoodie/hannibal"
keywords = ["actor", "stream"]
categories = ["asynchronous"]


readme = "README.md"
edition = "2024"
rust-version = "1.89"

[workspace]
members = ["hannibal-derive"]
exclude = ["hannibal-examples"]

[dependencies]
hannibal-derive = { path = "hannibal-derive", version = "0.14.2" }
thiserror = "2.0"
log = { version = "0.4", features = ["kv"] }
futures = { version = "0.3" }
dyn-clone = "1.0"
async-lock = "3"

tokio = { version = "1", features = ["full"], optional = true }

async-io = { version = "2.5.0", optional = true }
async-global-executor = { version = "3", optional = true }

async-channel = { version = "2.5.0", optional = true }

[features]
default = [
    "tokio_runtime",
    # "async_runtime",
    # "async_channel"
]
async_channel = ["dep:async-channel"]
futures_channel = []

tokio_runtime = ["runtime", "dep:tokio", "async-global-executor/tokio"]
async_runtime = ["runtime", "dep:async-io", "dep:async-global-executor"]

tokio = ["dep:tokio", "async-global-executor/tokio"]
runtime = []

[dev-dependencies]
tokio = { version = "1", features = ["full"] }
async-signals = "0.5.0"
libc = "0.2"
trybuild = "1"
test-log = "0.2"
env_logger = { version = "0.11", features = ["unstable-kv"] }
color-backtrace = "0.7"
assert_matches = "1.5"


[[example]]
name = "simple"
path = "examples/simple.rs"
required-features = ["runtime"]

[[example]]
name = "ping"
path = "examples/ping.rs"
required-features = ["runtime"]

[[example]]
name = "simple-channels-only"
path = "examples/simple-channels-only.rs"
required-features = ["tokio"]

[[example]]
name = "broker"
path = "examples/broker.rs"
required-features = ["runtime"]

[[example]]
name = "builder"
path = "examples/builder.rs"
required-features = ["runtime"]

[[example]]
name = "children"
path = "examples/children.rs"
required-features = ["runtime"]

[[example]]
name = "owning_addr"
path = "examples/owning_addr.rs"
required-features = ["runtime"]

[[example]]
name = "timeout"
path = "examples/timeout.rs"
required-features = ["runtime"]

[[example]]
name = "intervals"
path = "examples/intervals.rs"
required-features = ["runtime"]

[[example]]
name = "streams"
path = "examples/streams.rs"
required-features = ["runtime"]

[[example]]
name = "storage-service"
path = "examples/storage-service.rs"
required-features = ["runtime"]

[[example]]
name = "time-service"
path = "examples/time-service.rs"
required-features = ["runtime"]

[[example]]
name = "signal-service"
path = "examples/signal-service.rs"
required-features = ["runtime"]

[lints.rust]
unsafe_code = "forbid"
trivial_numeric_casts = "forbid"
unused_import_braces = "forbid"
missing_copy_implementations = "warn"
# missing_docs = "warn"
trivial_casts = "warn"
unstable_features = "warn"

[lints.clippy]
doc_markdown = "warn"
cast_lossless = "warn"
cast_possible_truncation = "warn"
clone_on_ref_ptr = "warn"
complexity = "warn"
correctness = "warn"
dbg_macro = "warn"
expect_used = "warn"
indexing_slicing = "warn"
manual_filter_map = "warn"
map_clone = "warn"
missing_const_for_fn = "warn"
missing_panics_doc = "warn"
needless_collect = "warn"
redundant_clone = "warn"
redundant_closure_for_method_calls = "warn"
style = "warn"
too_many_arguments = "warn"
useless_format = "warn"
