#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Treatment {
pub key: ::std::option::Option<::std::string::String>,
pub weight: f32,
pub description: ::std::option::Option<::std::string::String>,
pub flag_value: ::std::option::Option<crate::types::FlagValue>,
}
impl Treatment {
pub fn key(&self) -> ::std::option::Option<&str> {
self.key.as_deref()
}
pub fn weight(&self) -> f32 {
self.weight
}
pub fn description(&self) -> ::std::option::Option<&str> {
self.description.as_deref()
}
pub fn flag_value(&self) -> ::std::option::Option<&crate::types::FlagValue> {
self.flag_value.as_ref()
}
}
impl Treatment {
pub fn builder() -> crate::types::builders::TreatmentBuilder {
crate::types::builders::TreatmentBuilder::default()
}
}
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct TreatmentBuilder {
pub(crate) key: ::std::option::Option<::std::string::String>,
pub(crate) weight: ::std::option::Option<f32>,
pub(crate) description: ::std::option::Option<::std::string::String>,
pub(crate) flag_value: ::std::option::Option<crate::types::FlagValue>,
}
impl TreatmentBuilder {
pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.key = ::std::option::Option::Some(input.into());
self
}
pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.key = input;
self
}
pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
&self.key
}
pub fn weight(mut self, input: f32) -> Self {
self.weight = ::std::option::Option::Some(input);
self
}
pub fn set_weight(mut self, input: ::std::option::Option<f32>) -> Self {
self.weight = input;
self
}
pub fn get_weight(&self) -> &::std::option::Option<f32> {
&self.weight
}
pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.description = ::std::option::Option::Some(input.into());
self
}
pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.description = input;
self
}
pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
&self.description
}
pub fn flag_value(mut self, input: crate::types::FlagValue) -> Self {
self.flag_value = ::std::option::Option::Some(input);
self
}
pub fn set_flag_value(mut self, input: ::std::option::Option<crate::types::FlagValue>) -> Self {
self.flag_value = input;
self
}
pub fn get_flag_value(&self) -> &::std::option::Option<crate::types::FlagValue> {
&self.flag_value
}
pub fn build(self) -> crate::types::Treatment {
crate::types::Treatment {
key: self.key,
weight: self.weight.unwrap_or_default(),
description: self.description,
flag_value: self.flag_value,
}
}
}