[−][src]Function mice::roll
pub fn roll(input: &str) -> Result<ExpressionResult, RollError>
Evaluate a dice expression! This function takes the usual dice expression format, and allows an arbitrary number of terms.
let dice_expression = "d20 + 5 - d2"; println!("{}", roll(dice_expression)?);
An Err
is returned in the following cases:
- A d0 is used
- The sum of all terms is too high
- The sum of all terms is too low
- Nonsense input