Trait tyche::dice::roller::Roller

source ·
pub trait Roller {
    // Required method
    fn roll_die(&mut self, sides: u8) -> DieRoll;

    // Provided method
    fn roll<'d, 'r>(
        &mut self,
        dice: &'d Dice,
        apply_mods: bool
    ) -> Result<Rolled<'r>, Error>
       where Self: Sized,
             'd: 'r { ... }
}
Expand description

Rolls dice - what else is there to say?

Required Methods§

source

fn roll_die(&mut self, sides: u8) -> DieRoll

Rolls a single die.

Provided Methods§

source

fn roll<'d, 'r>( &mut self, dice: &'d Dice, apply_mods: bool ) -> Result<Rolled<'r>, Error>
where Self: Sized, 'd: 'r,

Rolls a set of dice and optionally applies all of its modifiers to the rolls.

§Errors

If any errors are encountered while applying the dice’s modifiers, an error variant is returned.

Implementors§

source§

impl Roller for FastRand

source§

impl Roller for Max

source§

impl Roller for Val

source§

impl<I: Iterator<Item = u8>> Roller for Iter<I>