pub struct Deck<C: Copy + Clone + Debug + Ord + Display>(/* private fields */);Expand description
Standard card deck
Implementations§
Source§impl<C: Copy + Clone + Debug + Ord + Display> Deck<C>
impl<C: Copy + Clone + Debug + Ord + Display> Deck<C>
Sourcepub fn draw_random(&mut self) -> Result<C, DeckError>
pub fn draw_random(&mut self) -> Result<C, DeckError>
Sourcepub fn draw_many_random(&mut self, count: usize) -> Vec<C>
pub fn draw_many_random(&mut self, count: usize) -> Vec<C>
Randomly draw up to
Sourcepub fn draw_many(&mut self, count: usize) -> Vec<C>
pub fn draw_many(&mut self, count: usize) -> Vec<C>
Draw up to
Sourcepub fn draw_rest_random(&mut self) -> Vec<C>
pub fn draw_rest_random(&mut self) -> Vec<C>
Randomly draw the rest of the cards
Sourcepub fn from_cards(cards: Vec<C>) -> Self
pub fn from_cards(cards: Vec<C>) -> Self
Create a new deck of cards
Trait Implementations§
Source§impl<C: DefaultCollection> Default for Deck<C>
impl<C: DefaultCollection> Default for Deck<C>
Source§impl<'de, C> Deserialize<'de> for Deck<C>
impl<'de, C> Deserialize<'de> for Deck<C>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<C: Eq + Copy + Clone + Debug + Ord + Display> Eq for Deck<C>
Source§impl<C: Copy + Clone + Debug + Ord + Display> Extend<C> for Deck<C>
impl<C: Copy + Clone + Debug + Ord + Display> Extend<C> for Deck<C>
Source§fn extend<I: IntoIterator<Item = C>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = C>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<C: Copy + Clone + Debug + Ord + Display> FromIterator<C> for Deck<C>
impl<C: Copy + Clone + Debug + Ord + Display> FromIterator<C> for Deck<C>
Source§fn from_iter<I: IntoIterator<Item = C>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = C>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<C: Ord + Copy + Clone + Debug + Ord + Display> Ord for Deck<C>
impl<C: Ord + Copy + Clone + Debug + Ord + Display> Ord for Deck<C>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<C: PartialOrd + Copy + Clone + Debug + Ord + Display> PartialOrd for Deck<C>
impl<C: PartialOrd + Copy + Clone + Debug + Ord + Display> PartialOrd for Deck<C>
impl<C: PartialEq + Copy + Clone + Debug + Ord + Display> StructuralPartialEq for Deck<C>
Auto Trait Implementations§
impl<C> Freeze for Deck<C>
impl<C> RefUnwindSafe for Deck<C>where
C: RefUnwindSafe,
impl<C> Send for Deck<C>where
C: Send,
impl<C> Sync for Deck<C>where
C: Sync,
impl<C> Unpin for Deck<C>where
C: Unpin,
impl<C> UnsafeUnpin for Deck<C>
impl<C> UnwindSafe for Deck<C>where
C: UnwindSafe,
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