2 releases

0.1.2 Jul 8, 2024
0.1.1 Jun 5, 2024
0.1.0 Jun 5, 2024

#535 in Audio

Download history 13/week @ 2024-07-30 8/week @ 2024-09-10 7/week @ 2024-09-17 23/week @ 2024-09-24 39/week @ 2024-10-01

139 downloads per month
Used in spotify_confidence_openfe…

Apache-2.0

46KB
1K SLoC

Rust Confidence SDK

Rust implementation of the Confidence.

Usage

Instantiating the Confidence

first, we need to setup the api config which contains a api_key and a region:

let api_config = APIConfig { api_key: "YOUR_API_KEY".to_string(), region: YOUR_REGION };

let confidence = Confidence::new(api_config)

after this initial setup we can start accessing the flags. Every time any of flags are asked, the sdk fetches them from the network and resolve the asked property.

The schema of the property plays a crucial role in resolving the property, if the schema type matches the asked type, the value will be returned otherwise we expect an MismatchType error from the EvaluationError.

// wrong type, should return error
let details_string = confidence.get_flag("hawkflag.message", "default".to_string()).await;
println!("details string -> {:?}", details_string);

Send custom Events

we can send custom events to the confidence sdk like following:

confidence.track("[EVENT-NAME]", HashMap::new());

Dependencies

~8–19MB
~249K SLoC