feat: added a Drift trait and a "default" ConstantDrift implementation
This commit is contained in:
14
src/drift.rs
Normal file
14
src/drift.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
pub trait Drift: Copy + Debug {
|
||||
fn variance_delta(&self, elapsed: i64) -> f64;
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct ConstantDrift(pub f64);
|
||||
|
||||
impl Drift for ConstantDrift {
|
||||
fn variance_delta(&self, elapsed: i64) -> f64 {
|
||||
elapsed as f64 * self.0 * self.0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user