diff --git a/Cargo.lock b/Cargo.lock index 81f6e96..160d671 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,21 +8,6 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bitflags" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" -dependencies = [ - "serde", -] - [[package]] name = "clap" version = "4.5.32" @@ -73,9 +58,6 @@ name = "miller" version = "0.1.0" dependencies = [ "clap", - "ron", - "semver", - "serde", ] [[package]] @@ -96,48 +78,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "ron" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63f3aa105dea217ef30d89581b65a4d527a19afc95ef5750be3890e8d3c5b837" -dependencies = [ - "base64", - "bitflags", - "serde", - "serde_derive", - "unicode-ident", -] - -[[package]] -name = "semver" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" -dependencies = [ - "serde", -] - -[[package]] -name = "serde" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "strsim" version = "0.11.1" diff --git a/Cargo.toml b/Cargo.toml index 336bc96..c76f02a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,13 +5,6 @@ edition = "2024" license = "MIT" license-file = "LICENSE" -[dependencies] -ron = "0.9" - -[dependencies.semver] -version = "1.0" -features = ["serde"] - [dependencies.clap] version = "4.5" default-features = false @@ -28,6 +21,5 @@ features = [ "string", ] -[dependencies.serde] -version = "1.0" -features = ["derive"] +[dependencies.gamelog] +path = "./gamelog" diff --git a/src/error.rs b/src/error.rs index 5432365..d7f47f0 100644 --- a/src/error.rs +++ b/src/error.rs @@ -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), diff --git a/src/gamelog/Cargo.toml b/src/gamelog/Cargo.toml new file mode 100644 index 0000000..e80c272 --- /dev/null +++ b/src/gamelog/Cargo.toml @@ -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"] diff --git a/src/gamelog/file.rs b/src/gamelog/src/file.rs similarity index 97% rename from src/gamelog/file.rs rename to src/gamelog/src/file.rs index 5264a26..3bda9da 100644 --- a/src/gamelog/file.rs +++ b/src/gamelog/src/file.rs @@ -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() } diff --git a/src/gamelog/mod.rs b/src/gamelog/src/lib.rs similarity index 61% rename from src/gamelog/mod.rs rename to src/gamelog/src/lib.rs index 58d1ec9..ca35ba7 100644 --- a/src/gamelog/mod.rs +++ b/src/gamelog/src/lib.rs @@ -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::*; diff --git a/src/gamelog/period.rs b/src/gamelog/src/period.rs similarity index 79% rename from src/gamelog/period.rs rename to src/gamelog/src/period.rs index 6725d13..b062687 100644 --- a/src/gamelog/period.rs +++ b/src/gamelog/src/period.rs @@ -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), } diff --git a/src/gamelog/play.rs b/src/gamelog/src/play.rs similarity index 100% rename from src/gamelog/play.rs rename to src/gamelog/src/play.rs diff --git a/src/gamelog/terrain.rs b/src/gamelog/src/terrain.rs similarity index 94% rename from src/gamelog/terrain.rs rename to src/gamelog/src/terrain.rs index c3cff5f..dcfe9ab 100644 --- a/src/gamelog/terrain.rs +++ b/src/gamelog/src/terrain.rs @@ -7,4 +7,5 @@ pub enum TerrainState { Yards(u8), GoalLine, Inches, + Unknown, } diff --git a/src/main.rs b/src/main.rs index 4378b0f..4f4b2df 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,5 @@ mod calculator; mod error; -mod gamelog; use clap::Parser; use core::panic; diff --git a/templates/logfile.ron b/templates/logfile.ron index ffc402d..ffc050e 100644 --- a/templates/logfile.ron +++ b/templates/logfile.ron @@ -4,7 +4,7 @@ [ GameRecord( - version: "0.2.0", + version: "0.3.0", periods: [ Period( start: First,