[][src]Struct rs_poker::core::FlatDeck

pub struct FlatDeck { /* fields omitted */ }

FlatDeck is a deck of cards that allows easy indexing into the cards. It does not provide contains methods.

Methods

impl FlatDeck[src]

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

How many cards are there in the deck ?

#[must_use] pub fn is_empty(&self) -> bool[src]

Have all cards been dealt ? This probably won't be used as it's unlikely that someone will deal all 52 cards from a deck.

#[must_use] pub fn sample(&self, n: usize) -> Vec<Card>[src]

Give a random sample of the cards still left in the deck

pub fn shuffle(&mut self)[src]

Randomly shuffle the flat deck. This will ensure the there's no order to the deck.

pub fn deal(&mut self) -> Option<Card>[src]

Deal a card if there is one there to deal. None if the deck is empty

Trait Implementations

impl Into<FlatDeck> for Deck[src]

#[must_use] fn into(self) -> FlatDeck[src]

Flatten a Deck into a FlatDeck.

impl<'a> IntoIterator for &'a FlatDeck[src]

This is useful for trying every possible 5 card hand

Probably not something that's going to be done in real use cases, but still not bad.

type Item = Vec<Card>

The type of the elements being iterated over.

type IntoIter = CardIter<'a>

Which kind of iterator are we turning this into?

impl Debug for FlatDeck[src]

impl Index<usize> for FlatDeck[src]

type Output = Card

The returned type after indexing.

impl Index<Range<usize>> for FlatDeck[src]

type Output = [Card]

The returned type after indexing.

impl Index<RangeTo<usize>> for FlatDeck[src]

type Output = [Card]

The returned type after indexing.

impl Index<RangeFrom<usize>> for FlatDeck[src]

type Output = [Card]

The returned type after indexing.

impl Index<RangeFull> for FlatDeck[src]

type Output = [Card]

The returned type after indexing.

Auto Trait Implementations

Blanket Implementations

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

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

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

type Error = !

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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