[package]
name = "throttle-kit"
version = "2.1.2"
edition = "2024"
rust-version = "1.85"
license = "MIT OR Apache-2.0"
description = "Rate limiting for Rust: GCRA (Generic Cell Rate Algorithm) with pluggable"
readme = "README.md"
repository = "https://github.com/WyattAu/ratelimit"
keywords = ["rate-limit", "gcra", "throttle"]
categories = ["web-programming"]
exclude = ["/target", "/target", "/fuzz"]
[dependencies]
tokio = { version = "1", features = ["time", "sync", "rt"] }
dashmap = { version = "6", optional = true }
thiserror = "2"
tower = { version = "0.5", optional = true }
tower-layer = { version = "0.3", optional = true }
http = { version = "1", optional = true }
axum = { version = "0.8", optional = true }
redis = { version = "0.25", optional = true, features = ["tokio-comp", "connection-manager"] }
rusqlite = { version = "0.31", optional = true, features = ["bundled"] }
tracing = "0.1"
metrics = { version = "0.24", optional = true }
[features]
default = ["in-memory"]
in-memory = ["dep:dashmap"]
sliding-window = ["dep:dashmap"]
redis = ["dep:redis"]
tower = ["dep:tower", "dep:tower-layer", "dep:http", "dep:axum"]
metrics = ["dep:metrics"]
sqlite = ["dep:rusqlite"]
test-util = []
[[bench]]
name = "ratelimit_bench"
harness = false
[[bench]]
name = "iai_hot_path"
harness = false
[[bench]]
name = "head_to_head"
harness = false
[dev-dependencies]
proptest = "1"
criterion = { version = "0.5", features = ["html_reports"] }
tokio = { version = "1", features = ["full"] }
iai-callgrind = "0.16"
redis = { version = "0.25", features = ["tokio-comp", "connection-manager"] }
testcontainers = "0.23"
testcontainers-modules = { version = "0.11", features = ["redis"] }
governor = { version = "0.10", default-features = false, features = ["std", "dashmap", "quanta"] }
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)'] }
[lints.clippy]
unwrap_used = "deny"
expect_used = "warn"
indexing_slicing = "deny"
panic = "deny"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[package.metadata.layers]
tier = "L2"