flipt

Crates.ioflipt
lib.rsflipt
version1.1.1
sourcesrc
created_at2022-12-01 03:41:17.481941
updated_at2024-04-24 19:48:29.722783
descriptionFlipt Server SDK
homepage
repository
max_upload_size
id727293
size49,857
George (GeorgeMac)

documentation

README

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.

Commit count: 0

cargo fmt