pub struct Game {
pub frame_count: usize,
/* private fields */
}Expand description
Contains the data for a bowling game.
Fields§
§frame_count: usizeThe total number of frames allowed for the Game.
Implementations§
Source§impl Game
impl Game
Sourcepub fn with_frame_count(frame_count: usize, frames: Vec<Frame>) -> Self
pub fn with_frame_count(frame_count: usize, frames: Vec<Frame>) -> Self
Create a new Game with a custom frame count.
Sourcepub fn is_perfect(&self) -> bool
pub fn is_perfect(&self) -> bool
Check if the Game is perfect (300).
Sourcepub fn computed_with_provider(&self, provider: impl ScoreProvider) -> Vec<usize>
pub fn computed_with_provider(&self, provider: impl ScoreProvider) -> Vec<usize>
Calculate the score for each Frame of the Game using a ScoreProvider.
Sourcepub fn computed(&self) -> Vec<usize>
pub fn computed(&self) -> Vec<usize>
Calculate the score for each Frame of the Game using the TenPinScoreProvider.
Sourcepub fn score_with_provider(&self, provider: impl ScoreProvider) -> usize
pub fn score_with_provider(&self, provider: impl ScoreProvider) -> usize
Caculate the current score for the Game using a ScoreProvider.
Sourcepub fn score(&self) -> usize
pub fn score(&self) -> usize
Caculate the current score for the Game using the TenPinScoreProvider.
Sourcepub fn max_with_provider(&self, provider: impl ScoreProvider) -> usize
pub fn max_with_provider(&self, provider: impl ScoreProvider) -> usize
Calculate the maximum score achievable for the Game using a ScoreProvider.
Sourcepub fn max(&self) -> usize
pub fn max(&self) -> usize
Calculate the maximum score achievable for the Game using the TenPinScoreProvider.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Game
impl RefUnwindSafe for Game
impl Send for Game
impl Sync for Game
impl Unpin for Game
impl UnsafeUnpin for Game
impl UnwindSafe for Game
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