Finish LogFile format and patch template/logfile.ron
This commit is contained in:
10
Cargo.lock
generated
10
Cargo.lock
generated
@@ -74,6 +74,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"ron",
|
"ron",
|
||||||
|
"semver",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -108,6 +109,15 @@ dependencies = [
|
|||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "semver"
|
||||||
|
version = "1.0.26"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.219"
|
version = "1.0.219"
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ version = "0.1.0"
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ron = "~0.9"
|
ron = "0.9"
|
||||||
|
|
||||||
|
[dependencies.semver]
|
||||||
|
version = "1.0"
|
||||||
|
features = ["serde"]
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
version = "4.5"
|
version = "4.5"
|
||||||
|
|||||||
@@ -14,7 +14,10 @@ impl TryFrom<File> for LogFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct GameRecord([Option<Period>; 4]);
|
struct GameRecord {
|
||||||
|
version: semver::Version,
|
||||||
|
periods: Vec<Option<Period>>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct Period {
|
struct Period {
|
||||||
@@ -57,7 +60,7 @@ enum Down {
|
|||||||
Second,
|
Second,
|
||||||
Third,
|
Third,
|
||||||
Fourth,
|
Fourth,
|
||||||
Pat,
|
PointAfterTouchdown,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Down {
|
impl Down {
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ struct Args {
|
|||||||
short,
|
short,
|
||||||
long,
|
long,
|
||||||
value_hint = clap::ValueHint::DirPath,
|
value_hint = clap::ValueHint::DirPath,
|
||||||
default_value = std::env::current_dir().expect("Failed to get current working dir.").into_os_string()
|
default_value = std::env::current_dir()
|
||||||
|
.expect("Failed to get current working dir.")
|
||||||
|
.into_os_string()
|
||||||
)]
|
)]
|
||||||
logfile_path: PathBuf,
|
logfile_path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,24 @@
|
|||||||
|
#![enable(implicit_some)]
|
||||||
|
#![enable(unwrap_newtypes)]
|
||||||
|
#![enable(unwrap_variant_newtypes)]
|
||||||
|
|
||||||
[
|
[
|
||||||
GameRecord ([
|
GameRecord(
|
||||||
Some(Period(
|
version: "0.0.1",
|
||||||
|
periods: [
|
||||||
|
Period(
|
||||||
start: First,
|
start: First,
|
||||||
end: Some(Fourth),
|
end: Fourth,
|
||||||
plays: [
|
plays: [
|
||||||
Play(
|
Play(
|
||||||
action: None,
|
action: None,
|
||||||
down: Kickoff,
|
down: Kickoff(
|
||||||
|
offence: Nebraska
|
||||||
|
),
|
||||||
terrain: 0
|
terrain: 0
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)),
|
)
|
||||||
None,
|
]
|
||||||
None,
|
)
|
||||||
None,
|
|
||||||
])
|
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user