pub struct Roll { /* private fields */ }
Expand description
A Roll represents a single computation, for instance “2d4+5”.
Create with fields:
let new_roll = Roll::new(20, 2, Modifiers::default());
Create by string:
let new_roll = Roll::from_str("2d20-7")?;
Execute:
let result = new_roll.execute();
println!("{}", result.total());
Roll::default() will build a “1d6+0” roll.
Implementations§
Trait Implementations§
Source§impl RedisInterface for Roll
impl RedisInterface for Roll
fn to_redis_hash(&self) -> RedisHash
impl StructuralPartialEq for Roll
Auto Trait Implementations§
impl Freeze for Roll
impl RefUnwindSafe for Roll
impl Send for Roll
impl Sync for Roll
impl Unpin for Roll
impl UnwindSafe for Roll
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more