Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
flowbrigade Rust bindings
Rust bindings for FlowBrigade's experimental C ABI.
The Nim package remains the reference implementation. This crate is a thin,
safe wrapper around the exported C ABI and intentionally starts with the stable
subset already present in include/flowbrigade.h.
This crate requires Nim/Nimble at build time unless FLOWBRIGADE_LIB_DIR
points to an existing native FlowBrigade library. See
REQUIREMENTS.md for the full setup requirements.
Compatibility
flowbrigade Rust crate 0.1.4 targets FlowBrigade core 0.4.1 or later and
FlowBrigade C ABI version 2.
The Rust crate version and the FlowBrigade core version are intentionally separate. The crate version tracks the Rust wrapper's own API stability, while the core version and C ABI version describe the native library it links to.
Installation
Install Nim and FlowBrigade first:
|
Then add the Rust crate:
During cargo build, this crate uses nimble path flowbrigade to find the
installed Nim package, builds FlowBrigade's C ABI library into Cargo's build
output directory, and links the Rust wrapper to it.
For local FlowBrigade development, point the binding at a checkout:
FLOWBRIGADE_SOURCE_DIR=/path/to/flowbrigade
If you already built the native library yourself, set FLOWBRIGADE_LIB_DIR to
the directory containing libflowbrigade.so, libflowbrigade.dylib, or
flowbrigade.dll.
Example
use Duration;
use TokenBucket;
let mut bucket = new?;
let decision = bucket.consume?;
assert!;
# Ok::
Implemented Surface
| Area | Rust API |
|---|---|
| ABI metadata | abi_version, abi_version_string, abi_supports |
| Duration helpers | parse_duration, format_duration |
| Backoff | BackoffPolicy::fixed, BackoffPolicy::linear, BackoffPolicy::exponential, delay_for |
| Token bucket | TokenBucket with inspect, consume, reset, configuration, and available-token helpers |
| GCRA | GcraLimiter with inspect, consume, allow, reset, configuration, interval, and capacity helpers |
| Fixed window | FixedWindow with inspect, consume, reset, configuration, and usage helpers |
| Keyed fixed window | KeyedFixedWindow with inspect, consume, clear, reset, reset-all, active-key, and configuration helpers |
| Keyed GCRA | KeyedGcraLimiter with inspect, consume, allow, prune, clear, reset, reset-all, active-key, and configuration helpers |
| Sliding window | SlidingWindow with inspect, consume, reset, configuration, and current-use helpers |
| Circuit breaker | CircuitBreaker with allow, success/failure recording, and state helpers |
| Bulkhead | Bulkhead with inspect, acquire, and release helpers |
| Keyed bulkhead | KeyedBulkhead with inspect, acquire, release, clear, and active-key helpers |
| Budget ledger | BudgetLedger with inspect, consume, refund, reset, and reset-all helpers |
| Retry allowance | RetryAllowance with original/retry recording, retry inspection, allow, clear, reset, reset-all, prune, active-key, and configuration helpers |
| Timeout and deadline | Timeout, Deadline, elapsed/remaining/expired checks, and deadline clamp |
| Lock store | LockStore, LockLease, acquire/release/refresh/inspect helpers |
| Throttle and debounce | Throttle, Debouncer state helpers |
| Retry callback runner | retry_run with Rust callback wrappers |
| Fallback callback runner | fallback_run with ordered Rust provider callbacks |
| Limiter registry | LimiterRegistry for named fixed, sliding, token bucket, keyed fixed, compound, and callback-backed stored fixed-window limiters |
| Observability export | RateLimitDecision and BudgetDecision JSON/Prometheus text export |