{"id":18054101,"url":"https://github.com/mbuesch/movavgrs","last_synced_at":"2025-04-05T08:22:47.574Z","repository":{"id":39667199,"uuid":"353437307","full_name":"mbuesch/movavgrs","owner":"mbuesch","description":"Rust: Generic Moving Average calculation","archived":false,"fork":false,"pushed_at":"2025-02-11T20:33:28.000Z","size":98,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T02:31:01.741Z","etag":null,"topics":["moving-average","rust","rust-lang"],"latest_commit_sha":null,"homepage":"https://bues.ch/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbuesch.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-31T17:27:31.000Z","updated_at":"2025-02-11T20:21:40.000Z","dependencies_parsed_at":"2024-07-28T20:50:51.052Z","dependency_job_id":null,"html_url":"https://github.com/mbuesch/movavgrs","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbuesch%2Fmovavgrs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbuesch%2Fmovavgrs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbuesch%2Fmovavgrs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbuesch%2Fmovavgrs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbuesch","download_url":"https://codeload.github.com/mbuesch/movavgrs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247307557,"owners_count":20917498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["moving-average","rust","rust-lang"],"created_at":"2024-10-31T00:09:17.022Z","updated_at":"2025-04-05T08:22:47.532Z","avatar_url":"https://github.com/mbuesch.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"movavg - Generic Moving Average calculation\n===========================================\n\n`Project home \u003chttps://bues.ch/\u003e`_\n\n`Git repository \u003chttps://bues.ch/cgit/movavgrs.git\u003e`_\n\n`Github repository \u003chttps://github.com/mbuesch/movavgrs\u003e`_\n\nGeneric `Moving Average \u003chttps://en.wikipedia.org/wiki/Moving_average\u003e`_ calculation for the integer types\n\n* i8, i16, i32, i64, i128, isize\n* u8, u16, u32, u64, u128, usize\n\nand float types\n\n* f32, f64\n\n\nExample Cargo.toml dependencies\n===============================\n\nAdd this to your Cargo.toml:\n\n.. code:: toml\n\n\t[dependencies]\n\tmovavg = \"2\"\n\n\nExample usage\n=============\n\n.. code:: rust\n\n\t// Integers\n\tlet mut avg: MovAvg\u003ci32, i32, 3\u003e = MovAvg::new(); // window size = 3\n\tassert_eq!(avg.feed(10), 10);\n\tassert_eq!(avg.feed(20), 15);\n\tassert_eq!(avg.feed(30), 20);\n\tassert_eq!(avg.feed(40), 30);\n\tassert_eq!(avg.get(), 30);\n\n\t// Floats\n\tlet mut avg: MovAvg\u003cf64, f64, 3\u003e = MovAvg::new();\n\tassert_eq!(avg.feed(10.0), 10.0);\n\tassert_eq!(avg.feed(20.0), 15.0);\n\tassert_eq!(avg.feed(30.0), 20.0);\n\tassert_eq!(avg.feed(40.0), 30.0);\n\tassert_eq!(avg.get(), 30.0);\n\n\t// Bigger accumulator\n\tlet mut avg: MovAvg\u003ci8, i32, 3\u003e = MovAvg::new();\n\tassert_eq!(avg.feed(100), 100);\n\tassert_eq!(avg.feed(100), 100); // This would overflow an i8 accumulator\n\n\nCargo Feature selections\n========================\n\nno_std\n------\n\nIf you want to use movavg without the `std` library (often called `no_std`), then use the following Cargo.toml dependency to disable the `std` feature:\n\n.. code:: toml\n\n\t[dependencies]\n\tmovavg = { version = \"2\", default-features = false }\n\nCurrently the `no_std` variant supports all functionality that the default `std` variant supports. But that may change in future.\n\nfastfloat\n---------\n\nThe `fastfloat` feature can be used to enable much faster, but less accurate floating point calculations. Enabling this feature leads to bigger floating point rounding and cancellation errors.\n\n.. code:: toml\n\n\t[dependencies]\n\tmovavg = { version = \"2\", features = [\"fastfloat\"] }\n\nThis feature may also be used together with disabled `std` feature (see `no_std`).\n\n\nRust compiler version\n=====================\n\nRequires Rust compiler version 1.61 or later.\n\n\nLicense\n=======\n\nCopyright (c) 2021-2023 Michael Büsch \u003cm@bues.ch\u003e\n\nLicensed under the Apache License version 2.0 or the MIT license, at your option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbuesch%2Fmovavgrs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbuesch%2Fmovavgrs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbuesch%2Fmovavgrs/lists"}