Expand description
生产级移动平均算法库
提供三种移动平均算法实现:
- 简单移动平均(SMA)
- 指数移动平均(EMA)
- 滚动移动平均(RMA)
§特性
no_std兼容- 线程安全设计
- 零成本抽象
- 完整文档测试
§示例
use moving_averages::{Sma, Ema, Rma, MovingAverage};
// SMA示例
let mut sma = Sma::<f64, 3>::new();
println!("SMA: {}", sma.next(10.0));
// 使用trait统一接口
let mut calculator: Box<dyn MovingAverage<f64>> = Box::new(sma);
println!("Average: {}", calculator.next(15.0));Re-exports§
Modules§
Traits§
- Moving
Average - 移动平均算法统一trait