Skip to main content

Context

Struct Context 

Source
pub struct Context { /* private fields */ }

Implementations§

Source§

impl Context

Source

pub fn new(data: ContextData) -> Self

Source

pub fn set_event_logger(&mut self, logger: EventLogger)

Source

pub fn is_ready(&self) -> bool

Source

pub fn is_failed(&self) -> bool

Source

pub fn is_finalized(&self) -> bool

Source

pub fn is_finalizing(&self) -> bool

Source

pub fn pending(&self) -> usize

Source

pub fn data(&self) -> &ContextData

Source

pub fn set_unit(&mut self, unit_type: &str, uid: &str) -> Result<(), String>

Source

pub fn get_unit(&self, unit_type: &str) -> Option<&String>

Source

pub fn get_units(&self) -> &HashMap<String, String>

Source

pub fn set_attribute( &mut self, name: &str, value: impl Into<Value>, ) -> Result<(), String>

Source

pub fn get_attribute(&self, name: &str) -> Option<&Value>

Source

pub fn get_attributes(&self) -> HashMap<String, Value>

Source

pub fn set_override(&mut self, experiment_name: &str, variant: i32)

Source

pub fn set_custom_assignment( &mut self, experiment_name: &str, variant: i32, ) -> Result<(), String>

Source

pub fn peek(&mut self, experiment_name: &str) -> i32

Source

pub fn treatment(&mut self, experiment_name: &str) -> i32

Source

pub fn track( &mut self, goal_name: &str, properties: impl Into<Value>, ) -> Result<(), String>

Source

pub fn variable_value( &mut self, key: &str, default_value: impl Into<Value>, ) -> Value

Source

pub fn peek_variable_value( &mut self, key: &str, default_value: impl Into<Value>, ) -> Value

Source

pub fn variable_keys(&self) -> HashMap<String, Vec<String>>

Source

pub fn custom_field_value( &self, experiment_name: &str, field_name: &str, ) -> Option<Value>

Source

pub fn custom_field_value_type( &self, experiment_name: &str, field_name: &str, ) -> Option<String>

Source

pub fn custom_field_keys(&self) -> Vec<String>

Source

pub fn experiments(&self) -> Vec<String>

Source

pub fn refresh(&mut self, new_data: ContextData)

Source

pub fn publish(&mut self)

Source

pub fn finalize(&mut self)

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, 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> 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.