pub struct ExperimentResult {
pub experiment_id: String,
pub user_id: String,
pub variant: Variant,
pub assigned_at: u64,
pub metrics: HashMap<String, f64>,
}Expand description
Experiment result tracking.
Fields§
§experiment_id: StringExperiment ID
user_id: StringUser ID
variant: VariantAssigned variant
assigned_at: u64Timestamp when assigned (milliseconds)
metrics: HashMap<String, f64>Custom metrics/properties
Implementations§
Source§impl ExperimentResult
impl ExperimentResult
Sourcepub fn new(
experiment_id: String,
user_id: String,
variant: Variant,
assigned_at: u64,
) -> Self
pub fn new( experiment_id: String, user_id: String, variant: Variant, assigned_at: u64, ) -> Self
Create a new experiment result.
Sourcepub fn add_metric(&mut self, name: impl Into<String>, value: f64)
pub fn add_metric(&mut self, name: impl Into<String>, value: f64)
Add a metric to the result.
Sourcepub fn get_metric(&self, name: &str) -> Option<f64>
pub fn get_metric(&self, name: &str) -> Option<f64>
Get a metric value.
Trait Implementations§
Source§impl Clone for ExperimentResult
impl Clone for ExperimentResult
Source§fn clone(&self) -> ExperimentResult
fn clone(&self) -> ExperimentResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExperimentResult
impl Debug for ExperimentResult
Source§impl<'de> Deserialize<'de> for ExperimentResult
impl<'de> Deserialize<'de> for ExperimentResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ExperimentResult
impl RefUnwindSafe for ExperimentResult
impl Send for ExperimentResult
impl Sync for ExperimentResult
impl Unpin for ExperimentResult
impl UnwindSafe for ExperimentResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more