Net Promoter Score (NPS®) Crates.io

A simple and easy-to-use Rust crate for calculating Net Promoter Scores (NPS) from survey responses. Survey responses are gathered with respondent IDs and accompanied by a rating from 0 to 10. The crate handles various edge cases and provides detailed error messages to help you write robust and accurate NPS calculators for your applications.

Features

Installation

Add this to your Cargo.toml:

toml [dependencies] net_promoter_score = "0.1.0"

Example Usage

```rust use netpromoterscore::prelude::*; use anyhow::Result;

fn main() -> Result<()> { let mut survey = Survey::new();

survey.add_response(1, 9)?;
survey.add_response(2, 8)?;
survey.add_response(3, 6)?;

let nps = survey.score();
println!("The calculated NPS is: {}", nps);

Ok(())

} ```

API

The main type provided by the crate is the Survey struct. The Survey has the following methods for adding responses and calculating the NPS:

Feedback and Contributions

I appreciate every feedback and suggestion you might have to improve this crate. Feel free to open an issue or submit a pull request if you want to contribute to the project directly.

License

This crate is free software: you can redistribute it and/or modify it under the terms of the MIT License.

Net Promoter®, NPS®, NPS Prism®, and the NPS-related emoticons are registered trademarks of Bain & Company, Inc., NICE Systems, Inc., and Fred Reichheld. Net Promoter Score and Net Promoter System are service marks of Bain & Company, Inc., NICE Systems, Inc., and Fred Reichheld.


Like this crate?

⭐ Star https://github.com/rrrodzilla/netpromoterscore

🐦 Follow https://twitter.com/rrrodzilla


readme created with cargo-markdown