pub struct TimedInternalGame { /* private fields */ }Expand description
Game information encompassing
- The time the game was recorded
- The
TimedInternalRatingof the opponent - The score as a number between
0.0(decisive opponent win) and1.0(decisive player win)
Keep in mind that this struct does not hold information about the player’s rating, only the opponent’s. This is because it is used to register games on and therefore update the player’s rating struct.
Implementations§
Source§impl TimedInternalGame
impl TimedInternalGame
Sourcepub fn new(time: SystemTime, opponent: TimedInternalRating, score: f64) -> Self
pub fn new(time: SystemTime, opponent: TimedInternalRating, score: f64) -> Self
Creates a new TimedInternalGame at the given time with the given opponent and score.
score is a number between 0.0 (decisive opponent win) and 1.0 (decisive player win).
§Panics
This function panics if score is less than 0.0 or greater than 1.0.
Sourcepub fn time(&self) -> SystemTime
pub fn time(&self) -> SystemTime
The time this game was recorded.
Sourcepub fn opponent(&self) -> TimedInternalRating
pub fn opponent(&self) -> TimedInternalRating
The opponent’s rating.
Sourcepub fn score(&self) -> f64
pub fn score(&self) -> f64
The game score as a number between 0.0 (decisive opponent win) and 1.0 (decisive player win).
Sourcepub fn raw_internal_game(&self) -> InternalGame
pub fn raw_internal_game(&self) -> InternalGame
The game with timing information erased and the opponent’s rating resolved to their rating at the time of the last update.
Sourcepub fn to_internal_game(&self, rating_period_duration: Duration) -> InternalGame
pub fn to_internal_game(&self, rating_period_duration: Duration) -> InternalGame
Converts this TimedInternalGame to an InternalGame,
erasing the timing information and resolving the opponents rating to their rating at the time of the game.
§Panics
This function panics if the opponent rating was updated after the game was recorded, or if the rating_period_duration is zero.
Sourcepub fn internal_game_at(
&self,
time: SystemTime,
rating_period_duration: Duration,
) -> InternalGame
pub fn internal_game_at( &self, time: SystemTime, rating_period_duration: Duration, ) -> InternalGame
Converts this TimedInternalGame to an InternalGame,
erasing the timing information and resolving the opponent’s rating to their rating at the given time.
§Panics
This function panics if the given time is before the opponent rating’s last update, or if rating_period_duration is zero.
Trait Implementations§
Source§impl Clone for TimedInternalGame
impl Clone for TimedInternalGame
Source§fn clone(&self) -> TimedInternalGame
fn clone(&self) -> TimedInternalGame
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more