[−][src]Struct cardpack::Pile
A Pile is a sortable collection of Cards.
Usage:
let mut pile = cardpack::Pile::default(); let ace_of_spades = cardpack::Card::new(cardpack::ACE, cardpack::SPADES); let ace_of_hearts = cardpack::Card::new(cardpack::ACE, cardpack::HEARTS); pile.add(ace_of_spades); pile.add(ace_of_hearts); pile.shuffle();
Implementations
impl Pile
[src]
pub fn new_from_vector(v: Vec<Card>) -> Pile
[src]
pub fn pile_on(piles: Vec<Pile>) -> Pile
[src]
Takes a reference to an Array of Piles and consolidates them into a single Pile of Cards.
pub fn pile_up<F>(x: usize, f: F) -> Pile where
F: Fn() -> Pile,
[src]
F: Fn() -> Pile,
Allows you to pass in an integer and a Pile returning function method and creates a Pile made up of the Piles generated that many times.
Usage:
let pile = cardpack::Pile::pile_up(6, cardpack::Pile::french_deck); pile.shuffle();
This creates and shuffles a Pile made up of six traditional French decks, which would be suitable for a casino blackjack table.
pub fn add(&mut self, elem: Card)
[src]
Places the Card at the bottom (end) of the Pile.
pub fn append(&mut self, other: &Pile)
[src]
Appends a clone of the passed in Pile of Cards to the existing Pile.
pub fn by_index(&self) -> String
[src]
pub fn by_index_locale(&self, lid: &LanguageIdentifier) -> String
[src]
pub fn by_symbol_index(&self) -> String
[src]
pub fn by_symbol_index_locale(&self, lid: &LanguageIdentifier) -> String
[src]
pub fn card_by_index(&self, index: &str) -> Option<&Card>
[src]
pub fn cards(&self) -> &Vec<Card>
[src]
Returns a reference to the Vector containing all the cards.
pub fn contains(&self, card: &Card) -> bool
[src]
Tests if a card is in the Pile.
pub fn contains_all(&self, pile: &Pile) -> bool
[src]
Tests if every element is inside the Pile.
pub fn demo(&self)
[src]
This function is designed to demonstrate the capabilities of the library.
pub fn demo_short(&self)
[src]
pub fn draw(&mut self, x: usize) -> Option<Pile>
[src]
pub fn draw_first(&mut self) -> Option<Card>
[src]
pub fn draw_last(&mut self) -> Option<Card>
[src]
pub fn first(&self) -> Option<&Card>
[src]
pub fn get(&self, index: usize) -> Option<&Card>
[src]
pub fn get_random(&self) -> Option<&Card>
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn last(&self) -> Option<&Card>
[src]
pub fn len(&self) -> usize
[src]
pub fn map_by_suit(&self) -> HashMap<Suit, Pile>
[src]
Takes a pile and returns a HashMap with the key as each Suit in the Pile with the values as a Pile of the cards for that Suit.
pub fn position(&self, karte: &Card) -> Option<usize>
[src]
pub fn pile_by_index(&self, indexes: &[&str]) -> Option<Pile>
[src]
pub fn prepend(&mut self, other: &Pile)
[src]
pub fn rank_indexes(&self) -> String
[src]
Returns a String of all of the Rank Index Characters for a Pile.
pub fn remove(&mut self, index: usize) -> Card
[src]
pub fn remove_card(&mut self, card: &Card) -> Option<Card>
[src]
pub fn shuffle(&self) -> Pile
[src]
pub fn shuffle_in_place(&mut self)
[src]
pub fn sort(&self) -> Pile
[src]
pub fn sort_in_place(&mut self)
[src]
pub fn suits(&self) -> Vec<Suit>
[src]
Returns a sorted collection of the unique Suits in a Pile.
pub fn values(&self) -> impl Iterator<Item = &Card>
[src]
pub fn jokers() -> Pile
[src]
pub fn canasta_base_single_deck() -> Pile
[src]
pub fn canasta_single_deck() -> Pile
[src]
pub fn euchre_deck() -> Pile
[src]
pub fn french_deck() -> Pile
[src]
pub fn french_deck_with_jokers() -> Pile
[src]
pub fn pinochle_deck() -> Pile
[src]
pub fn skat_deck() -> Pile
[src]
pub fn spades_deck() -> Pile
[src]
pub fn tarot_deck() -> Pile
[src]
pub fn sig_generate_from_strings(strings: &[String]) -> String
[src]
Trait Implementations
impl Clone for Pile
[src]
impl Debug for Pile
[src]
impl Default for Pile
[src]
impl Display for Pile
[src]
Sets the to_string() function for a Pile to return the default index signature for the Pile.
impl FromIterator<Card> for Pile
[src]
fn from_iter<T: IntoIterator<Item = Card>>(iter: T) -> Self
[src]
impl Hash for Pile
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl IntoIterator for Pile
[src]
type Item = Card
The type of the elements being iterated over.
type IntoIter = IntoIter<Self::Item>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl PartialEq<Pile> for Pile
[src]
impl StructuralPartialEq for Pile
[src]
Auto Trait Implementations
impl RefUnwindSafe for Pile
impl Send for Pile
impl Sync for Pile
impl Unpin for Pile
impl UnwindSafe for Pile
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AnyEq for T where
T: PartialEq<T> + Any,
T: PartialEq<T> + Any,
pub fn equals(&self, other: &(dyn Any + 'static)) -> bool
pub fn as_any(&self) -> &(dyn Any + 'static)
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,