feat: added a Drift trait and a "default" ConstantDrift implementation

This commit is contained in:
2026-03-16 12:06:04 +01:00
parent 853f177fa8
commit a1f282a1c8
14 changed files with 423 additions and 127 deletions

14
src/drift.rs Normal file
View 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
}
}