| Crates.io | flipt |
| lib.rs | flipt |
| version | 1.4.0 |
| created_at | 2022-12-01 03:41:17.481941+00 |
| updated_at | 2025-10-14 14:12:33.018994+00 |
| description | Flipt Server SDK |
| homepage | |
| repository | |
| max_upload_size | |
| id | 727293 |
| size | 66,101 |
This directory contains the Rust source code for the Flipt server-side client.
API documentation is available at https://www.flipt.io/docs/reference/overview.
cargo add flipt
In your Rust code you can import this client and use it as so:
use std::collections::HashMap;
use flipt::api::FliptClient;
use flipt::evaluation::models::EvaluationRequest;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = FliptClient::default();
let mut context: HashMap<String, String> = HashMap::new();
context.insert("fizz".into(), "buzz".into());
let variant_result = client
.evaluation
.variant(&EvaluationRequest {
namespace_key: "default".into(),
flag_key: "flag1".into(),
entity_id: "entity".into(),
context: context.clone(),
reference: None,
})
.await
.unwrap();
print!("{:?}", variant_result);
There is a more detailed example in the examples directory.
You can set custom HTTP headers for the client by using the with_headers method in the ConfigBuilder.
let client = FliptClient::new(ConfigBuilder::default().with_headers(HeaderMap::new()).build());
Flipt V2 introduces the concept of environments. This client supports evaluation of flags in a specific environment by using the X-Flipt-Environment header.
let client = FliptClient::new(ConfigBuilder::default().with_headers(HeaderMap::from_iter([("X-Flipt-Environment".into(), "production".into())])).build());