meter as library

This commit is contained in:
Wiktor Mazur
2019-08-14 13:59:40 +02:00
parent 7f812c5ec9
commit d066407876
8 changed files with 435 additions and 137 deletions
+10 -6
View File
@@ -11,12 +11,16 @@ mod player;
use player::Player;
#[derive(Debug, Copy, Clone, PartialEq)]
struct DPS(f32);
pub struct DPS(f32);
impl DPS {
fn new(damage: f32, time: f32) -> Self {
Self(damage / time * 1000.0)
}
}
pub fn value(&self) -> f32 {
self.0
}
}
#[derive(Hash, Eq, PartialEq)]
@@ -28,10 +32,10 @@ pub struct Session {
#[derive(Debug, PartialEq)]
pub struct PlayerStatistics {
player: String,
damage: f32,
time_in_combat: f32,
dps: DPS
pub player: String,
pub damage: f32,
pub time_in_combat: f32,
pub dps: DPS
}
impl Session {
+1
View File
@@ -74,6 +74,7 @@ impl Player
}
#[cfg(test)]
mod test
{
use super::*;