[−][src]Struct rs_poker::core::FlatDeck
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]
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?
ⓘImportant traits for CardIter<'a>#[must_use]
fn into_iter(self) -> CardIter<'a>
[src]
impl Debug for FlatDeck
[src]
impl Index<usize> for FlatDeck
[src]
type Output = Card
The returned type after indexing.
#[must_use]
fn index(&self, index: usize) -> &Card
[src]
impl Index<Range<usize>> for FlatDeck
[src]
type Output = [Card]
The returned type after indexing.
#[must_use]
fn index(&self, index: Range<usize>) -> &[Card]
[src]
impl Index<RangeTo<usize>> for FlatDeck
[src]
type Output = [Card]
The returned type after indexing.
#[must_use]
fn index(&self, index: RangeTo<usize>) -> &[Card]
[src]
impl Index<RangeFrom<usize>> for FlatDeck
[src]
type Output = [Card]
The returned type after indexing.
#[must_use]
fn index(&self, index: RangeFrom<usize>) -> &[Card]
[src]
impl Index<RangeFull> for FlatDeck
[src]
Auto Trait Implementations
impl Send for FlatDeck
impl Sync for FlatDeck
impl Unpin for FlatDeck
impl UnwindSafe for FlatDeck
impl RefUnwindSafe for FlatDeck
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,