pub struct CurrentTrick { /* private fields */ }Expand description
Trick-in-progress — 0 to 3 cards played, in playing order
Cards are played by the seats starting at leader in playing
order: the first card by leader, the second by leader.lho(), and so on.
§Invariants
- At most 3 cards are stored (enforced by the backing
ArrayVec<Card, 3>). - The stored cards are pairwise distinct.
Implementations§
Source§impl CurrentTrick
impl CurrentTrick
Sourcepub fn from_slice(
trump: Strain,
leader: Seat,
played: &[Card],
) -> Result<Self, CurrentTrickError>
pub fn from_slice( trump: Strain, leader: Seat, played: &[Card], ) -> Result<Self, CurrentTrickError>
Build from a slice, validating the 0–3-card length and pairwise disjointness invariants.
§Errors
Returns a CurrentTrickError if the slice has more than 3 entries or
contains a duplicate card.
Sourcepub fn try_push(&mut self, card: Card) -> Result<(), CurrentTrickError>
pub fn try_push(&mut self, card: Card) -> Result<(), CurrentTrickError>
Append one card to the trick.
§Errors
Returns CurrentTrickError::TooManyPlayed if the trick already holds
3 cards, or CurrentTrickError::DuplicatePlayedCard if card is
already in the trick.
Trait Implementations§
Source§impl Clone for CurrentTrick
impl Clone for CurrentTrick
Source§fn clone(&self) -> CurrentTrick
fn clone(&self) -> CurrentTrick
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CurrentTrick
impl Debug for CurrentTrick
Source§impl Hash for CurrentTrick
impl Hash for CurrentTrick
Source§impl PartialEq for CurrentTrick
impl PartialEq for CurrentTrick
impl Eq for CurrentTrick
impl StructuralPartialEq for CurrentTrick
Auto Trait Implementations§
impl Freeze for CurrentTrick
impl RefUnwindSafe for CurrentTrick
impl Send for CurrentTrick
impl Sync for CurrentTrick
impl Unpin for CurrentTrick
impl UnsafeUnpin for CurrentTrick
impl UnwindSafe for CurrentTrick
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