Enum dice::Expression
[−]
[src]
pub enum Expression { Binary(Binary, Box<Expression>, Box<Expression>), Constant(u32), Die(Die, Option<Reroll>), Dice(Dice, Option<Reroll>, Fold), }
A dice rolling expression.
Variants
Binary(Binary, Box<Expression>, Box<Expression>)
A binary expression.
Constant(u32)
A constant expression.
Die(Die, Option<Reroll>)
A die expression.
Dice(Dice, Option<Reroll>, Fold)
A dice expression.
Methods
impl Expression
[src]
fn minimum(&self) -> Option<i32>
Returns the smallest possible result of rolling this dice rolling expression.
fn maximum(&self) -> Option<i32>
Returns the largest possible result of rolling this dice rolling expression.
fn average(&self) -> Option<Ratio>
Returns the average result of rolling this dice rolling expression.
fn results(&self) -> Option<Vec<i32>>
Returns all the possible results of rolling this dice rolling expression.
fn probabilities(&self) -> Option<Vec<(i32, Ratio)>>
Returns the probabilities of all the possible results of rolling this dice rolling expression.
impl Expression
[src]
fn roll(&self, rng: &mut Rng) -> Option<i32>
Rolls this dice rolling expression and returns the result.
This method returns None
if any of the binary operations fail (e.g., integer overflow).
Trait Implementations
impl Clone for Expression
[src]
fn clone(&self) -> Expression
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Expression
[src]
impl PartialEq for Expression
[src]
fn eq(&self, __arg_0: &Expression) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Expression) -> bool
This method tests for !=
.