[][src]Struct destiny::DiceDistribution

pub struct DiceDistribution {
    pub dice_string: String,
    pub possible_rolls: Vec<i64>,
    pub distribution: HashMap<i64, i64>,
    pub roll_percentages: HashMap<i64, f64>,
    pub roll_over: HashMap<i64, f64>,
    pub roll_under: HashMap<i64, f64>,
}

A struct used to hold the information about a dice distribution.

Examples

use destiny::DiceDistribution;
 
let dd = DiceDistribution::new("1d4");
 
assert_eq!(vec![1, 2, 3, 4], dd.possible_rolls);

Fields

dice_string: Stringpossible_rolls: Vec<i64>distribution: HashMap<i64, i64>roll_percentages: HashMap<i64, f64>roll_over: HashMap<i64, f64>roll_under: HashMap<i64, f64>

Methods

impl DiceDistribution[src]

pub fn new(dice_string: &str) -> DiceDistribution[src]

Creates a new DiceDistribution. This uses the supplied string to calculate the possible rolls, the distrribution of those rolls and the percentage chance to roll any particular value.

pub fn table(&self) -> Table[src]

Creates a prettytable::Table containing a representation of self.

pub fn ptable(&self)[src]

Creates and prints to stdout a table representation of self.

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,