Function rouler::roll_dice_or_fail
source · [−]Expand description
A function for throwaway die rolls that do not need to be saved as a
Roller
. Provided for convenience.
Takes an input of a &str
containing syntax for a die roll, returns Ok(total)
if the input parses successfully, otherwise a ParsingError
.
Examples
use rouler::roll_dice_or_fail;
assert!(roll_dice_or_fail("6d6").is_ok());
assert!(roll_dice_or_fail("food4").is_err())