[][src]Function one_d_six::try_quickroll

pub fn try_quickroll<T: Rollable>(dice_format: &str) -> Result<T, String> where
    T: DiceTotal<T>,
    T: FromStr

Attempts to roll dice based on a 1d6 style string.

Example

use one_d_six::try_quickroll;

if let Ok(roll) = try_quickroll::<u32>("1d6") {
    assert!(roll >= 1);
    assert!(roll <= 6);
} else {
    unreachable!();
}