Expand description
Rust SDK for Replane: dynamic configuration with real-time updates.
The client keeps an SSE connection to the Replane server, holds every config of the SDK key’s project and environment in memory, and evaluates overrides locally, so reads are synchronous and the context never leaves your process.
use replane::{ConnectOptions, Context, Replane};
#[tokio::main]
async fn main() -> replane::Result<()> {
let replane = Replane::builder()
.default_value("rate-limit", 100)
.connect(ConnectOptions::new("https://replane.example.com", "rp_..."))
.await?;
let ctx = Context::new().with("plan", "pro");
let limit: u32 = replane.get_with("rate-limit", &ctx)?;
println!("rate limit: {limit}");
Ok(())
}Structs§
- Config
- A config as delivered by the Replane SDK API: a base value plus overrides that are evaluated locally against the caller’s context.
- Config
Change - Notification passed to subscribers when a config changes on the server.
- Connect
Options - Options for connecting to a Replane server.
- Context
- Properties that overrides are evaluated against, e.g. user ID, plan or region.
- Override
- An override replaces the base value when all of its conditions match.
- Replane
- Replane client.
- Replane
Builder - Builder for
Replane. - Snapshot
- A serializable copy of the client’s configs, e.g. to hydrate another client.
- Subscription
- Handle returned by
Replane::subscribe; dropping it unsubscribes.
Enums§
- Condition
- An override condition with config references already resolved by the server.
- Context
Value - A primitive value used for override evaluation.
- Evaluation
Result - Replane
Error - Errors returned by the Replane client.
Constants§
- REPLANE_
CLIENT_ ID_ KEY - Context key holding an ID generated per client, usable for segmentation. A value provided in the client context takes precedence.
Functions§
- evaluate_
condition - evaluate_
overrides - Returns the value of the first override whose conditions all match, or
base.