10 releases

0.3.1 Mar 3, 2025
0.3.0 Feb 8, 2025
0.1.7 Jul 5, 2024

#1924 in Math

Download history 21/week @ 2024-12-15 27/week @ 2024-12-22 2/week @ 2024-12-29 16/week @ 2025-01-05 57/week @ 2025-01-12 36/week @ 2025-01-19 24/week @ 2025-01-26 109/week @ 2025-02-02 93/week @ 2025-02-09 80/week @ 2025-02-16 79/week @ 2025-02-23 179/week @ 2025-03-02 36/week @ 2025-03-09 33/week @ 2025-03-16 49/week @ 2025-03-23 42/week @ 2025-03-30

165 downloads per month

MIT license

14KB
285 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);

Dependencies

~150KB