pub struct Iter<I: Iterator<Item = u8>>(/* private fields */);
Expand description
Generates rolls from an iterator of values. Mainly useful for testing purposes.
§Examples
use tyche::dice::{roller::{Iter as IterRoller, Roller}, Dice, DieRoll};
let mut roller = IterRoller::new(vec![1, 2, 3, 4, 10]);
let dice = Dice::new(5, 6);
assert_eq!(
roller.roll(&dice, true)?.rolls,
vec![DieRoll::new(1), DieRoll::new(2), DieRoll::new(3), DieRoll::new(4), DieRoll::new(10)]
);
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<I> RefUnwindSafe for Iter<I>where
I: RefUnwindSafe,
impl<I> Send for Iter<I>where
I: Send,
impl<I> Sync for Iter<I>where
I: Sync,
impl<I> Unpin for Iter<I>where
I: Unpin,
impl<I> UnwindSafe for Iter<I>where
I: UnwindSafe,
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
].