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

#480 in Web programming

Download history 13/week @ 2024-01-16 3/week @ 2024-02-13 56/week @ 2024-02-20 11/week @ 2024-02-27 1/week @ 2024-03-05 2/week @ 2024-03-12 1/week @ 2024-03-26 5/week @ 2024-04-02 140/week @ 2024-04-09 3/week @ 2024-04-16 126/week @ 2024-04-23 7/week @ 2024-04-30

276 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