Trait dicetest::Die [−][src]
pub trait Die<T>: DieOnce<T> {
fn roll(&self, fate: Fate<'_>) -> T;
fn map<U, F>(self, f: F) -> MapDie<T, U, Self, F>
where
Self: Sized,
F: Fn(T) -> U,
{ ... }
fn flatten<U>(self) -> FlattenDie<U, T, Self>
where
Self: Sized,
T: DieOnce<U>,
{ ... }
fn flat_map<U, UD, F>(self, f: F) -> FlatMapDie<T, U, Self, UD, F>
where
Self: Sized,
UD: DieOnce<U>,
F: Fn(T) -> UD,
{ ... }
fn boxed<'a>(self) -> BoxedDie<'a, T>
where
Self: Sized + 'a,
{ ... }
fn rc<'a>(self) -> RcDie<'a, T>
where
Self: Sized + 'a,
{ ... }
fn arc(self) -> ArcDie<T>
where
Self: Sized + 'static,
{ ... }
}Expand description
Trait for generating pseudorandom values of type T.
The Die trait represents a subset of DieOnce. It mirrors all methods of
DieOnce without the suffix _once. These methods must behave in the same way.
For example an implementation of Die must produce the same value with its methods
roll and roll_once if they are called with the same Fate.