pub struct Val(pub u8);
Expand description
Generates rolls that always have a specific value.
§Examples
use tyche::dice::{roller::{Roller, Val as ValRoller}, Dice};
let mut roller = ValRoller(42);
let dice = Dice::new(4, 6);
let rolled = roller.roll(&dice, true)?;
assert!(rolled.rolls.iter().all(|roll| roll.val == 42));
let dice = Dice::new(2, 20);
let rolled = roller.roll(&dice, true)?;
assert!(rolled.rolls.iter().all(|roll| roll.val == 42));
Tuple Fields§
§0: u8
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Val
impl Send for Val
impl Sync for Val
impl Unpin for Val
impl UnwindSafe for Val
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
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
An iterator over the items within this container, by reference.
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
Check whether an item is contained within this sequence.
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
Convert an item of the sequence into a [
MaybeRef
].