#average #statistics

moving-average

A simple moving average library

8 releases

0.1.7 Jul 5, 2024
0.1.6 Jul 5, 2024

#1497 in Math

Download history 76/week @ 2024-08-08 38/week @ 2024-08-15 38/week @ 2024-08-22 66/week @ 2024-08-29 69/week @ 2024-09-05 66/week @ 2024-09-12 79/week @ 2024-09-19 116/week @ 2024-09-26 114/week @ 2024-10-03 90/week @ 2024-10-10 92/week @ 2024-10-17 64/week @ 2024-10-24 54/week @ 2024-10-31 84/week @ 2024-11-07 80/week @ 2024-11-14 71/week @ 2024-11-21

291 downloads per month

MIT license

9KB
210 lines

moving-average

Structure to hold the moving average of a value


lib.rs:

Moving Average Library

moving_average is a library for calculating the moving average on a stream of data.

Features

  • Calculate moving average in an ergonomic way.

Usage

First, add this to your Cargo.toml:

[dependencies]
moving_average = "0.1.0"

Then, add this to your crate root:

extern crate moving_average;

Basic Operations

You can create a new Moving instance and add or subtract values from it:

use moving_average::Moving;

let mut moving_average: Moving<usize> = Moving::new();
moving_average.add(10);
moving_average.add(20);
assert_eq!(moving_average, 15);

No runtime deps