pub struct DriftRule {
pub field: String,
pub strategy: DriftStrategy,
pub params: HashMap<String, Value>,
pub rate: f64,
pub min_value: Option<Value>,
pub max_value: Option<Value>,
pub states: Option<Vec<String>>,
pub transitions: Option<HashMap<String, Vec<(String, f64)>>>,
}Expand description
Drift rule configuration
Fields§
§field: StringField to apply drift to
strategy: DriftStrategyDrift strategy
params: HashMap<String, Value>Parameters for the drift strategy
rate: f64Rate of change (per request or per time unit)
min_value: Option<Value>Minimum value (for numeric fields)
max_value: Option<Value>Maximum value (for numeric fields)
states: Option<Vec<String>>Possible states (for state machine)
transitions: Option<HashMap<String, Vec<(String, f64)>>>Transition probabilities (for state machine)
Implementations§
Source§impl DriftRule
impl DriftRule
Sourcepub fn new(field: String, strategy: DriftStrategy) -> Self
pub fn new(field: String, strategy: DriftStrategy) -> Self
Create a new drift rule
Sourcepub fn with_bounds(self, min: Value, max: Value) -> Self
pub fn with_bounds(self, min: Value, max: Value) -> Self
Set value bounds
Sourcepub fn with_states(self, states: Vec<String>) -> Self
pub fn with_states(self, states: Vec<String>) -> Self
Set states for state machine
Sourcepub fn with_transitions(
self,
transitions: HashMap<String, Vec<(String, f64)>>,
) -> Self
pub fn with_transitions( self, transitions: HashMap<String, Vec<(String, f64)>>, ) -> Self
Set transitions for state machine
Sourcepub fn with_param(self, key: String, value: Value) -> Self
pub fn with_param(self, key: String, value: Value) -> Self
Add a parameter
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DriftRule
impl<'de> Deserialize<'de> for DriftRule
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 DriftRule
impl RefUnwindSafe for DriftRule
impl Send for DriftRule
impl Sync for DriftRule
impl Unpin for DriftRule
impl UnwindSafe for DriftRule
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