statsig_rust/gcir/
gcir_options.rs

1use serde::Deserialize;
2use std::collections::HashSet;
3
4use crate::{GCIRResponseFormat, HashAlgorithm};
5
6#[derive(Deserialize)]
7pub struct ClientInitResponseOptions {
8    pub hash_algorithm: Option<HashAlgorithm>,
9    pub client_sdk_key: Option<String>,
10    pub include_local_overrides: Option<bool>,
11    pub feature_gate_filter: Option<HashSet<String>>,
12    pub experiment_filter: Option<HashSet<String>>,
13    pub dynamic_config_filter: Option<HashSet<String>>,
14    pub layer_filter: Option<HashSet<String>>,
15    pub param_store_filter: Option<HashSet<String>>,
16    pub response_format: Option<GCIRResponseFormat>,
17    pub remove_id_type: Option<bool>,
18    pub remove_default_value_gates: Option<bool>,
19}
20
21impl ClientInitResponseOptions {
22    pub(crate) fn get_hash_algorithm(&self) -> &HashAlgorithm {
23        self.hash_algorithm.as_ref().unwrap_or(&HashAlgorithm::Djb2)
24    }
25}
26
27impl Default for ClientInitResponseOptions {
28    fn default() -> Self {
29        Self {
30            hash_algorithm: Some(HashAlgorithm::Djb2),
31            client_sdk_key: None,
32            include_local_overrides: Some(false),
33            feature_gate_filter: None,
34            experiment_filter: None,
35            dynamic_config_filter: None,
36            layer_filter: None,
37            param_store_filter: None,
38            response_format: None,
39            remove_id_type: Some(false),
40            remove_default_value_gates: Some(false),
41        }
42    }
43}