Statsig

Struct Statsig 

Source
pub struct Statsig {
    pub statsig_runtime: Arc<StatsigRuntime>,
    pub options: Arc<StatsigOptions>,
    pub event_emitter: SdkEventEmitter,
    /* private fields */
}

Fields§

§statsig_runtime: Arc<StatsigRuntime>§options: Arc<StatsigOptions>§event_emitter: SdkEventEmitter

Implementations§

Source§

impl Statsig

Source

pub fn new(sdk_key: &str, options: Option<Arc<StatsigOptions>>) -> Self

Source

pub async fn initialize(&self) -> Result<(), StatsigErr>

Initializes the Statsig client and returns an error if initialization fails.

This method performs the client initialization and returns Ok(()) if successful. If the initialization completes with failure details, it returns a StatsigErr describing the failure.

For detailed information about the initialization process—regardless of success or failure— use [initialize_with_details] instead.

§Errors

Returns a StatsigErr if the client fails to initialize successfully.

Source

pub async fn initialize_with_details( &self, ) -> Result<InitializeDetails, StatsigErr>

Initializes the Statsig client and returns detailed information about the process.

This method returns a InitializeDetails struct, which includes metadata such as the success status, initialization source, and any failure details. Even if initialization fails, this method does not return an error; instead, the init_success field will be false and failure_details may be populated.

§Returns

Returns a InitializeDetails struct, which includes metadata such as the success status, initialization source, and any failure details.

Source

pub fn get_initialize_details(&self) -> InitializeDetails

Source

pub fn is_initialized(&self) -> bool

Source

pub async fn shutdown(&self) -> Result<(), StatsigErr>

Source

pub async fn shutdown_with_timeout( &self, timeout: Duration, ) -> Result<(), StatsigErr>

Source

pub fn get_context(&self) -> StatsigContext

Source§

impl Statsig

Source§

impl Statsig

Source§

impl Statsig

Source

pub fn log_event( &self, user: &StatsigUser, event_name: &str, value: Option<String>, metadata: Option<HashMap<String, String>>, )

Source

pub fn log_event_with_number( &self, user: &StatsigUser, event_name: &str, value: Option<f64>, metadata: Option<HashMap<String, String>>, )

Source

pub fn forward_log_line_event( &self, user: &StatsigUser, log_level: StatsigLogLineLevel, value: Option<String>, metadata: Option<HashMap<String, String>>, )

Source

pub fn log_layer_param_exposure_with_layer_json( &self, layer_json: String, parameter_name: String, )

Source

pub fn log_layer_param_exposure_with_layer( &self, layer: Layer, parameter_name: String, )

Source

pub async fn flush_events(&self)

Source§

impl Statsig

Source

pub fn get_string_parameter_from_store( &self, user: &StatsigUser, parameter_store_name: &str, parameter_name: &str, fallback: Option<String>, options: Option<ParameterStoreEvaluationOptions>, ) -> Option<String>

Source

pub fn get_boolean_parameter_from_store( &self, user: &StatsigUser, parameter_store_name: &str, parameter_name: &str, fallback: Option<bool>, options: Option<ParameterStoreEvaluationOptions>, ) -> Option<bool>

Source

pub fn get_float_parameter_from_store( &self, user: &StatsigUser, parameter_store_name: &str, parameter_name: &str, fallback: Option<f64>, options: Option<ParameterStoreEvaluationOptions>, ) -> Option<f64>

Source

pub fn get_integer_parameter_from_store( &self, user: &StatsigUser, parameter_store_name: &str, parameter_name: &str, fallback: Option<i64>, options: Option<ParameterStoreEvaluationOptions>, ) -> Option<i64>

Source

pub fn get_array_parameter_from_store( &self, user: &StatsigUser, parameter_store_name: &str, parameter_name: &str, fallback: Option<Vec<Value>>, options: Option<ParameterStoreEvaluationOptions>, ) -> Option<Vec<Value>>

Source

pub fn get_object_parameter_from_store( &self, user: &StatsigUser, parameter_store_name: &str, parameter_name: &str, fallback: Option<HashMap<String, Value>>, options: Option<ParameterStoreEvaluationOptions>, ) -> Option<HashMap<String, Value>>

Source

pub fn get_parameter_from_store<T: DeserializeOwned>( &self, user: &StatsigUser, parameter_store_name: &str, parameter_name: &str, fallback: Option<T>, options: Option<ParameterStoreEvaluationOptions>, ) -> Option<T>

Source

pub fn get_parameter_store( &self, parameter_store_name: &str, ) -> ParameterStore<'_>

Source

pub fn get_parameter_store_with_options( &self, parameter_store_name: &str, options: ParameterStoreEvaluationOptions, ) -> ParameterStore<'_>

Source§

impl Statsig

Source

pub fn identify(&self, user: &StatsigUser)

Source§

impl Statsig

Source

pub fn get_cmab_ranked_groups( &self, user: &StatsigUser, cmab_name: &str, ) -> Vec<CMABRankedGroup>

Source

pub fn log_cmab_exposure_for_group( &self, user: &StatsigUser, cmab_name: &str, group_id: String, )

Source§

impl Statsig

Source

pub fn override_gate(&self, gate_name: &str, value: bool, id: Option<&str>)

Source

pub fn override_dynamic_config( &self, config_name: &str, value: HashMap<String, Value>, id: Option<&str>, )

Source

pub fn override_layer( &self, layer_name: &str, value: HashMap<String, Value>, id: Option<&str>, )

Source

pub fn override_experiment( &self, experiment_name: &str, value: HashMap<String, Value>, id: Option<&str>, )

Source

pub fn override_experiment_by_group_name( &self, experiment_name: &str, group_name: &str, id: Option<&str>, )

Source

pub fn remove_gate_override(&self, gate_name: &str, id: Option<&str>)

Source

pub fn remove_dynamic_config_override( &self, config_name: &str, id: Option<&str>, )

Source

pub fn remove_experiment_override( &self, experiment_name: &str, id: Option<&str>, )

Source

pub fn remove_layer_override(&self, layer_name: &str, id: Option<&str>)

Source

pub fn remove_all_overrides(&self)

Source§

impl Statsig

Source§

impl Statsig

Source

pub fn check_gate(&self, user: &StatsigUser, gate_name: &str) -> bool

Source

pub fn check_gate_with_options( &self, user: &StatsigUser, gate_name: &str, options: FeatureGateEvaluationOptions, ) -> bool

Source

pub fn get_feature_gate( &self, user: &StatsigUser, gate_name: &str, ) -> FeatureGate

Source

pub fn get_feature_gate_with_options( &self, user: &StatsigUser, gate_name: &str, options: FeatureGateEvaluationOptions, ) -> FeatureGate

Source

pub fn manually_log_gate_exposure(&self, user: &StatsigUser, gate_name: &str)

Source

pub fn get_fields_needed_for_gate(&self, gate_name: &str) -> Vec<String>

Source§

impl Statsig

Source

pub fn get_dynamic_config( &self, user: &StatsigUser, dynamic_config_name: &str, ) -> DynamicConfig

Source

pub fn get_dynamic_config_with_options( &self, user: &StatsigUser, dynamic_config_name: &str, options: DynamicConfigEvaluationOptions, ) -> DynamicConfig

Source

pub fn manually_log_dynamic_config_exposure( &self, user: &StatsigUser, dynamic_config_name: &str, )

Source

pub fn get_fields_needed_for_dynamic_config( &self, config_name: &str, ) -> Vec<String>

Source§

impl Statsig

Source

pub fn get_experiment( &self, user: &StatsigUser, experiment_name: &str, ) -> Experiment

Source

pub fn get_experiment_with_options( &self, user: &StatsigUser, experiment_name: &str, options: ExperimentEvaluationOptions, ) -> Experiment

Source

pub fn manually_log_experiment_exposure( &self, user: &StatsigUser, experiment_name: &str, )

Source

pub fn get_fields_needed_for_experiment( &self, experiment_name: &str, ) -> Vec<String>

Source

pub fn get_experiment_by_group_name( &self, experiment_name: &str, group_name: &str, ) -> Experiment

Source§

impl Statsig

Source

pub fn get_layer(&self, user: &StatsigUser, layer_name: &str) -> Layer

Source

pub fn get_layer_with_options( &self, user: &StatsigUser, layer_name: &str, options: LayerEvaluationOptions, ) -> Layer

Source

pub fn manually_log_layer_parameter_exposure( &self, user: &StatsigUser, layer_name: &str, parameter_name: String, )

Source

pub fn get_fields_needed_for_layer(&self, layer_name: &str) -> Vec<String>

Methods from Deref<Target = SdkEventEmitter>§

Source

pub fn subscribe<F>(&self, event: &str, callback: F) -> SubscriptionID
where F: Fn(SdkEvent<'_>) + Send + Sync + 'static,

Source

pub fn unsubscribe(&self, event: &str)

Source

pub fn unsubscribe_by_id(&self, subscription_id: &SubscriptionID)

Source

pub fn unsubscribe_all(&self)

Trait Implementations§

Source§

impl Drop for Statsig

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Deref for Statsig

Source§

type Target = SdkEventEmitter

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoOptional<T> for T

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,