[package]
edition = "2024"
rust-version = "1.85"
name = "rate-net"
version = "1.0.0"
authors = ["James Gober <me@jamesgober.com>"]
build = false
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "A powerful, lock-free rate limiter for Rust: multiple algorithms behind one trait, sharded per-key state, bounded-memory eviction, retry-after, and a one-line Tier-1 API. Built against hostile traffic."
homepage = "https://github.com/jamesgober/rate-net"
documentation = "https://docs.rs/rate-net"
readme = "README.md"
keywords = [
"rate-limiting",
"rate-limiter",
"throttle",
"governor",
"backpressure",
]
categories = [
"concurrency",
"network-programming",
"algorithms",
]
license = "Apache-2.0 OR MIT"
repository = "https://github.com/jamesgober/rate-net"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = [
"--cfg",
"docsrs",
]
[features]
algorithms = []
async = [
"std",
"dep:tokio",
]
default = ["std"]
std = [
"dep:better-bucket",
"better-bucket/clock",
"dep:clock-lib",
"clock-lib/std",
"dep:error-forge",
"dep:ahash",
]
[lib]
name = "rate_net"
path = "src/lib.rs"
[[example]]
name = "algorithms"
path = "examples/algorithms.rs"
required-features = ["algorithms"]
[[example]]
name = "async_wait"
path = "examples/async_wait.rs"
required-features = ["async"]
[[example]]
name = "gatekeeper"
path = "examples/gatekeeper.rs"
[[example]]
name = "mock_clock"
path = "examples/mock_clock.rs"
[[example]]
name = "per_key"
path = "examples/per_key.rs"
[[example]]
name = "per_second"
path = "examples/per_second.rs"
[[example]]
name = "retry_after"
path = "examples/retry_after.rs"
[[test]]
name = "alloc"
path = "tests/alloc.rs"
[[test]]
name = "consumer_pattern"
path = "tests/consumer_pattern.rs"
[[test]]
name = "hardening"
path = "tests/hardening.rs"
[[test]]
name = "loom_check"
path = "tests/loom_check.rs"
[[test]]
name = "proptest_algorithms"
path = "tests/proptest_algorithms.rs"
[[test]]
name = "proptest_overadmit"
path = "tests/proptest_overadmit.rs"
[[test]]
name = "stress"
path = "tests/stress.rs"
[[bench]]
name = "comparison"
path = "benches/comparison.rs"
harness = false
[[bench]]
name = "rate_bench"
path = "benches/rate_bench.rs"
harness = false
[dependencies.ahash]
version = "0.8"
optional = true
[dependencies.better-bucket]
version = "1.0"
optional = true
default-features = false
[dependencies.clock-lib]
version = "1.0"
optional = true
default-features = false
[dependencies.error-forge]
version = "1.0"
optional = true
[dependencies.tokio]
version = "1"
features = ["time"]
optional = true
default-features = false
[dev-dependencies.criterion]
version = "0.5"
features = ["html_reports"]
[dev-dependencies.proptest]
version = "1"
[target."cfg(comparison)".dev-dependencies.governor]
version = "0.8"
[target."cfg(loom)".dev-dependencies.loom]
version = "0.7"
[target."cfg(not(loom))".dev-dependencies.tokio]
version = "1"
features = [
"macros",
"rt",
"time",
]
default-features = false
[lints.rust.unexpected_cfgs]
level = "warn"
priority = 0
check-cfg = [
"cfg(loom)",
"cfg(comparison)",
"cfg(docsrs)",
]
[profile.release]
opt-level = 3
lto = "fat"
codegen-units = 1
strip = "symbols"