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
60
61
62
//! Client for the [FluxGate](https://github.com/forgeopslabs) feature toggle edge server.
//!
//! It evaluates flags over [OFREP](https://openfeature.dev/specification/appendix-c), the
//! OpenFeature Remote Evaluation Protocol, authenticated with a FluxGate client's SDK key.
//!
//! ```no_run
//! use fluxgate::{EvaluationContext, FluxGateClient};
//!
//! # async fn run() -> Result<(), fluxgate::ConfigError> {
//! let fluxgate = FluxGateClient::new("https://edge.example.com", &std::env::var("FLUXGATE_SDK_KEY").unwrap())?;
//! let user = EvaluationContext::new("user-1").with("country", "CA").with("user_tier", "plus");
//!
//! if fluxgate.is_enabled("new-checkout", &user).await {
//! // ...
//! }
//! let theme = fluxgate.evaluate("checkout-theme", "classic".to_owned(), &user).await;
//! println!("{} (variant {:?}, reason {})", theme.value, theme.variant, theme.reason);
//! # Ok(())
//! # }
//! ```
//!
//! - [`FluxGateClient`] makes one OFREP call per flag and context, cached for 30 seconds.
//! Evaluations never fail: on any error they return your default value with an
//! [`ErrorCode`].
//! - [`FlagSnapshot`], from [`FluxGateClient::watch`], loads every flag for one context in one
//! call and polls for changes; evaluations against it are synchronous.
//! - [`blocking`] (feature `blocking`) is a synchronous client for code without an async
//! runtime.
//! - [`openfeature`] (feature `openfeature`) is an OpenFeature provider.
//!
//! # Feature flags
//!
//! - `rustls` (default): TLS through rustls.
//! - `native-tls`: TLS through the operating system's library.
//! - `blocking`: the [`blocking`] module.
//! - `openfeature`: the [`openfeature`] module.
pub use ;
pub use EvaluationContext;
pub use ;
pub use ;
pub use ;
/// JSON values, as flags and context attributes hold them.
pub use Value;