18 releases (3 stable)
1.1.1 | Apr 24, 2024 |
---|---|
1.0.0 | Jan 16, 2024 |
0.6.0 | Nov 15, 2023 |
0.4.5 | May 24, 2023 |
0.3.1 | Dec 8, 2022 |
#469 in Web programming
1,073 downloads per month
14KB
374 lines
Flipt Rust
This directory contains the Rust source code for the Flipt server-side client.
Documentation
API documentation is available at https://www.flipt.io/docs/reference/overview.
Installation
cargo add flipt
Usage
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.
Dependencies
~5–17MB
~221K SLoC