1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! # feature-flag
//!
//! Server-side feature flag evaluation for async Rust services.
//!
//! ## Design rules
//!
//! 1. **No external RNG.** Sticky bucketing is a SHA-256 of `(flag_id ‖ subject_id)`
//! mod 100 — deterministic, no entropy source, no `rand` dep.
//! 2. **Tokio is assumed.** Hot reload uses `tokio::fs` + an async watcher.
//! 3. **Cheap clones.** The evaluator is `Arc`-shaped under the hood, so handing
//! it to many tasks is free.
//! 4. **Snapshot for tests.** Build a [`FlagSet`] in code, drop it into a
//! [`FlagEvaluator`], evaluate. No I/O required.
//!
//! ## Primitives
//!
//! - [`FlagSet`] — declarative collection of flags, deserialised from JSON.
//! - [`Flag`] — one named flag with default + ordered targeting [`Rule`]s.
//! - [`Rule`] — a `match_when` [`Predicate`] plus an outcome ([`Variant`] or
//! percentage rollout).
//! - [`Predicate`] — small DSL of typed comparisons + `all_of` / `any_of` / `not`.
//! - [`Subject`] — the entity being evaluated (id + arbitrary attributes).
//! - [`FlagEvaluator`] — combines a [`FlagSet`] with a sticky-bucketing function.
//! - [`HotReloader`] — watches a JSON file for changes and atomically swaps the
//! evaluator's [`FlagSet`].
//!
//! ## Composes with
//!
//! - **[reliability-toolkit-rs](https://github.com/mizcausevic-dev/reliability-toolkit-rs)** —
//! wrap a rollout-controlled call in a circuit breaker + retry.
//! - **[slo-budget-tracker](https://github.com/mizcausevic-dev/slo-budget-tracker)** —
//! if your SLO is burning, flip the flag to `default_off` from a remote
//! config push.
pub use FeatureFlagError;
pub use ;
pub use HotReloader;
pub use ;
pub use ;
pub use Subject;