18 releases (3 stable)

new 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

#623 in Web programming

Download history 7/week @ 2024-01-08 13/week @ 2024-01-15 55/week @ 2024-02-19 15/week @ 2024-02-26 3/week @ 2024-03-11 6/week @ 2024-04-01 139/week @ 2024-04-08 4/week @ 2024-04-15 124/week @ 2024-04-22

273 downloads per month

MIT license

14KB
374 lines

Flipt Rust

crates.io

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
~247K SLoC