Bump gamelog to 0.3.0 and migrate to own library.

This commit is contained in:
Cutieguwu
2025-03-27 12:42:52 -04:00
parent 0d742945b6
commit ab4522ba2d
11 changed files with 27 additions and 75 deletions

View File

@@ -14,7 +14,7 @@ impl fmt::Display for LogFileError {
Self::CompatibilityCheck(ver) => write!(
f,
"GameLogs cannot be older than {}, but {} was found in logfile.",
crate::gamelog::GAMELOG_MIN_VER.to_string(),
crate::gamelog::MIN_VER.to_string(),
ver.to_string()
),
Self::RonSpannedError(err) => write!(f, "{}", err),

15
src/gamelog/Cargo.toml Normal file
View File

@@ -0,0 +1,15 @@
[package]
name = "gamelog"
version = "0.3.0"
edition = "2024"
[dependencies]
ron = "0.9"
[dependencies.semver]
version = "1.0"
features = ["serde"]
[dependencies.serde]
version = "1.0"
features = ["derive"]

View File

@@ -49,7 +49,7 @@ impl LogFile {
fn is_compatible(&self) -> bool {
self.clone()
.get_min_ver()
.cmp_precedence(&super::GAMELOG_MIN_VER)
.cmp_precedence(&super::MIN_VER)
.is_lt()
}

View File

@@ -3,7 +3,8 @@ mod period;
mod play;
mod terrain;
pub const GAMELOG_MIN_VER: semver::Version = semver::Version::new(0, 2, 0);
#[allow(unused)]
pub const MIN_VER: semver::Version = semver::Version::new(0, 2, 0);
pub use file::LogFile;
pub use period::*;

View File

@@ -1,5 +1,8 @@
use serde::Deserialize;
#[deprecated(since = "0.2.0", note = "Migrated to Game")]
type GameRecord = Game;
#[derive(Debug, Deserialize, Clone)]
pub struct Game {
pub version: semver::Version,
@@ -19,4 +22,5 @@ pub enum Quarter {
Second,
Third,
Fourth,
Overtime(u8),
}

View File

@@ -7,4 +7,5 @@ pub enum TerrainState {
Yards(u8),
GoalLine,
Inches,
Unknown,
}

View File

@@ -1,6 +1,5 @@
mod calculator;
mod error;
mod gamelog;
use clap::Parser;
use core::panic;