pub struct Pack { /* private fields */ }
Expand description
A Pack is an immutable pile of cards. Packs are designed to be a flexible representation of a deck, stack, discard pile, or hand.
Packs available are for a traditional 52 card French Deck, pinochle, spades, skat and tarot.
§Usage:
let pack = cardpack::Pack::french_deck();
let mut shuffled = pack.cards().shuffle();
let sb = shuffled.draw(2).unwrap();
let bb = shuffled.draw(2).unwrap();
println!("small blind: {}", sb.to_symbol_index());
println!("big blind: {}", bb);
println!();
println!("flop : {}", shuffled.draw(3).unwrap());
println!("turn : {}", shuffled.draw(1).unwrap());
println!("river: {}", shuffled.draw(1).unwrap());
Implementations§
source§impl Pack
impl Pack
sourcepub fn is_complete(&self, piles: &[Pile]) -> bool
pub fn is_complete(&self, piles: &[Pile]) -> bool
Returns true of the combined Cards from the passed in Vector match the Cards in the Pack.
sourcepub fn contains(&self, card: &Card) -> bool
pub fn contains(&self, card: &Card) -> bool
Returns true if the passed in Card
is a part of the Pack
.
pub fn canasta_deck() -> Self
pub fn euchre_deck() -> Self
pub fn hand_and_foot_deck() -> Self
pub fn french_deck() -> Self
pub fn french_deck_with_jokers() -> Self
pub fn pinochle_deck() -> Self
pub fn short_deck() -> Self
pub fn skat_deck() -> Self
pub fn spades_deck() -> Self
pub fn tarot_deck() -> Self
Trait Implementations§
impl StructuralPartialEq for Pack
Auto Trait Implementations§
impl Freeze for Pack
impl RefUnwindSafe for Pack
impl Send for Pack
impl Sync for Pack
impl Unpin for Pack
impl UnwindSafe for Pack
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)