[][src]Struct hidden::dispenser::Dispenser

pub struct Dispenser { /* fields omitted */ }

A struct that holds a hidden variable, dispenses Hands with a lock on a state, and shuffles afterward.

Implementations

impl Dispenser[src]

pub fn new(len: usize) -> Self[src]

Creates a new Dispenser, initializing it with choices for a slice of a given len.

pub fn len(&self) -> usize[src]

Returns the effective len argument given to new for this object.

pub fn make_hand<'h, T>(&mut self, deck: &'h [T]) -> Option<Hand<'h, T>>[src]

Creates a Hand from deck and an internal variable, this shuffles the variable afterwards.

This makes first sure that all possible choices are possible for deck, it does this by checking the length of deck, and effectively comparing it to the len given when the Dispenser was created.

This function returns None when it's possible that elements in deck cannot be chosen, or there are more possible choices than that deck has. (deck.len() != len)

This function returns Some when checks pass, and all choices has a corresponding element in deck.

pub fn make_hand_unchecked<'h, T>(&mut self, deck: &'h [T]) -> Hand<'h, T>[src]

Creates a Hand, similar to make_hand, but without the check to see if all choices can land, and all elements are choosable.

Trait Implementations

impl Debug for Dispenser[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,