pub struct Die { /* private fields */ }
Implementations§
Source§impl Die
impl Die
Sourcepub fn new(faces: NonZeroU32) -> Die
pub fn new(faces: NonZeroU32) -> Die
Creates a new Die with the specified number of faces
Sourcepub fn roll(&self) -> u32
pub fn roll(&self) -> u32
Roll one die. Returns random number in the range from 1 to Die::faces()
.
Sourcepub fn faces(&self) -> NonZeroU32
pub fn faces(&self) -> NonZeroU32
Number of Die sides
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Die
impl RefUnwindSafe for Die
impl Send for Die
impl Sync for Die
impl Unpin for Die
impl UnwindSafe for Die
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