2 releases

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

#261 in Audio


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

~7–18MB
~258K SLoC