pub struct ScoreSheet(/* private fields */);Expand description
A collection of scoring items accumulated for a hand, crib, or play phase.
ScoreSheet records individual scoring items (ScoreItem) and provides
utility methods to calculate totals and construct common scoring scenarios
such as pegging points, hand scoring, and crib scoring.
Implementations§
Source§impl ScoreSheet
impl ScoreSheet
Sourcepub fn add_event(self, kind: ScoreKind, cards: &[Card], points: Points) -> Self
pub fn add_event(self, kind: ScoreKind, cards: &[Card], points: Points) -> Self
Adds a scoring event to this sheet and returns the updated sheet.
§Parameters
kind: The type of score (e.g., pair, run, fifteen).cards: The cards contributing to this scoring event.points: The number of points awarded.
Sourcepub fn add_event_if(
self,
condition: bool,
kind: ScoreKind,
cards: &[Card],
points: Points,
) -> Self
pub fn add_event_if( self, condition: bool, kind: ScoreKind, cards: &[Card], points: Points, ) -> Self
Conditionally adds a scoring event if condition is true.
§Parameters
condition: Whether to record the scoring event.kind: The type of score.cards: The cards contributing to this scoring event.points: The number of points awarded.
Sourcepub fn items(&self) -> &Vec<ScoreItem>
pub fn items(&self) -> &Vec<ScoreItem>
Returns an immutable reference to the underlying list of scoring items.
Sourcepub fn his_heels(cut: Card) -> Self
pub fn his_heels(cut: Card) -> Self
ScoreSheet constructor returning a ScoreSheet for the starter-card
“his heels” bonus, if applicable.
§Parameters
cut: The starter card.
Sourcepub fn play_card(play_state: &PlayState) -> Self
pub fn play_card(play_state: &PlayState) -> Self
ScoreSheet constructor returning a ScoreSheet for the most recent
Play of a card in the current play state.
§Parameters
play_state: The current play state to evaluate.
Sourcepub fn go(play_state: &PlayState) -> Self
pub fn go(play_state: &PlayState) -> Self
ScoreSheet constructor returning a ScoreSheet for the most recent
Go declaration.
§Parameters
play_state: The current play state to evaluate.
Sourcepub fn hand(hand: &Hand, cut: StarterCut) -> Self
pub fn hand(hand: &Hand, cut: StarterCut) -> Self
ScoreSheet constructor returning a ScoreSheet for the given hand and starter cut.
§Parameters
hand: The player’s hand.cut: The starter card.
Sourcepub fn crib(crib: &Crib, cut: StarterCut) -> Self
pub fn crib(crib: &Crib, cut: StarterCut) -> Self
ScoreSheet constructor returning a ScoreSheet for the crib and starter cut.
§Parameters
crib: The crib cards.cut: The starter card.
Trait Implementations§
Source§impl Clone for ScoreSheet
impl Clone for ScoreSheet
Source§fn clone(&self) -> ScoreSheet
fn clone(&self) -> ScoreSheet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScoreSheet
impl Debug for ScoreSheet
Source§impl Default for ScoreSheet
impl Default for ScoreSheet
Source§fn default() -> ScoreSheet
fn default() -> ScoreSheet
Source§impl<'de> Deserialize<'de> for ScoreSheet
impl<'de> Deserialize<'de> for ScoreSheet
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>,
Source§impl Display for ScoreSheet
impl Display for ScoreSheet
Source§impl PartialEq for ScoreSheet
impl PartialEq for ScoreSheet
Source§impl Serialize for ScoreSheet
impl Serialize for ScoreSheet
impl Eq for ScoreSheet
impl StructuralPartialEq for ScoreSheet
Auto Trait Implementations§
impl Freeze for ScoreSheet
impl RefUnwindSafe for ScoreSheet
impl Send for ScoreSheet
impl Sync for ScoreSheet
impl Unpin for ScoreSheet
impl UnwindSafe for ScoreSheet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more