[−][src]Crate extended_fizzbuzz
This library provides a configurable FizzBuzz implementation.
Examples
FizzBuzz from 1 to 15
use extended_fizzbuzz::{fizzbuzz, Matcher}; let matchers = vec![ Matcher::new(3, "Fizz").unwrap(), Matcher::new(5, "Buzz").unwrap(), ]; fizzbuzz(1, 15, &matchers).unwrap();
Output:
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
FizzBuzz for single numbers
use extended_fizzbuzz::{line, Matcher}; let matchers = vec![ Matcher::new(3, "Fizz").unwrap(), Matcher::new(5, "Buzz").unwrap(), ]; assert_eq!(line(6, &matchers), "Fizz".to_string()); assert_eq!(line(7, &matchers), "7".to_string()); assert_eq!(line(10, &matchers), "Buzz".to_string()); assert_eq!(line(15, &matchers), "FizzBuzz".to_string());
Structs
Matcher | A container for configuration values. |
Enums
FizzBuzzError | All errors the |
MatcherError | All errors a |
Functions
fizzbuzz | Provides a configurable version of FizzBuzz. |
line | Provides a configurable version of FizzBuzz for a single number. |