cargo updates

This commit is contained in:
Robin Appelman 2026-11-13 00:14:45 +01:00
commit 3aef9e288c
Signed by: robin
SSH key fingerprint: SHA256:kifqgrqnut7q1YUIrI0AdMNC23qiKAS/T9uGFmIYvbE
5 changed files with 498 additions and 857 deletions

1344
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,6 @@
[package]
name = "log-analyser"
version = "0.1.0"
authors = ["Robin Appelman <robin@icewind.nl>"]
edition = "2018"
[[bin]]
@ -9,19 +8,27 @@ name = "log-normalizer"
path = "src/main.rs"
[dependencies]
sqlx = { version = "0.7.3", default-features = false, features = ["macros", "postgres", "json", "chrono", "runtime-tokio-rustls"] }
anyhow = "1.0.104"
chrono = { version = "0.4.45", features = ["serde"] }
dotenvy = "0.15.7"
main_error = "0.1.2"
tokio = { version = "1.36.0", features = ["macros", "time", "rt-multi-thread"] }
serde = { version = "1.0.196", features = ["derive"] }
serde_with = "3.6.1"
serde_json = "1.0.113"
chrono = { version = "0.4.33", features = ["serde"] }
steamid-ng = "1.0.0"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
anyhow = "1.0.79"
serde = { version = "1.0.229", features = ["derive"] }
serde_json = "1.0.154"
serde_with = "3.24.0"
sqlx = { version = "0.9.0", default-features = false, features = [
"chrono",
"json",
"macros",
"postgres",
"runtime-tokio",
] }
steamid-ng = { version = "3.0.0", features = ["serde"] }
tokio = { version = "1.54.1", features = ["macros", "rt-multi-thread", "time"] }
tracing = "0.1.44"
tracing-subscriber = "0.3.23"
# https://github.com/transact-rs/sqlx/pull/4303 should be safe to remove after the next sqlx release
whoami = { version = "2.1.3", default-features = false, features = ["std"] }
[dev-dependencies]
insta = { version = "1.34.0", features = ["ron"] }
test-case = "3.3.1"
insta = { version = "1.49.0", features = ["ron"] }
test-case = "3.4.1"

View file

@ -47,6 +47,7 @@ pub enum GameMode {
}
#[derive(Debug, Clone, Copy, sqlx::Type, Deserialize, Serialize, Eq, PartialEq)]
#[allow(dead_code)]
pub enum EventType {
Charge,
PointCap,

View file

@ -4,7 +4,7 @@ use crate::raw::RawLog;
pub use crate::raw::{
ChatMessage, ClassNumbers, Event, KillStreak, Player, RoundPlayer, Teams, Uploader,
};
use chrono::{DateTime, NaiveDateTime, Utc};
use chrono::{DateTime, Utc};
use serde::Deserialize;
use std::cmp::Ordering;
use std::collections::HashMap;
@ -91,9 +91,7 @@ impl Info {
}
pub fn date(&self) -> DateTime<Utc> {
NaiveDateTime::from_timestamp_opt(self.date as i64, 0)
.unwrap()
.and_utc()
DateTime::from_timestamp(self.date as i64, 0).unwrap()
}
}
@ -256,7 +254,7 @@ fn get_round_end_time(round: &Round) -> u32 {
Event::RoundWin { time, .. } => Some(*time),
_ => None,
})
.last()
.next_back()
.unwrap_or_default()
}
@ -265,7 +263,7 @@ fn get_first_event_time(round: &Round) -> u32 {
.events
.iter()
.map(|event| event.time())
.last()
.next_back()
.unwrap_or_default()
}
@ -277,7 +275,7 @@ fn get_round_point_capped(round: &Round) -> u8 {
Event::PointCap { point, .. } => Some(*point),
_ => None,
})
.last()
.next_back()
.unwrap_or_default()
}
@ -307,7 +305,7 @@ fn get_last_cap_time(round: &Round) -> u32 {
Event::PointCap { time, .. } => Some(*time),
_ => None,
})
.last()
.next_back()
.unwrap_or_default()
}

View file

@ -4,7 +4,8 @@ use serde::{Deserialize, Deserializer, Serialize};
use serde_with::{serde_as, DefaultOnNull};
use std::borrow::Cow;
use std::collections::HashMap;
use std::convert::{TryFrom, TryInto};
use std::convert::TryFrom;
use std::str::FromStr;
use steamid_ng::SteamID;
#[derive(Debug, Clone, Deserialize, Serialize)]
@ -340,13 +341,13 @@ pub enum ChatFrom {
}
impl TryFrom<String> for ChatFrom {
type Error = steamid_ng::SteamIDError;
type Error = steamid_ng::SteamIDParseError;
fn try_from(value: String) -> Result<Self, Self::Error> {
if value == "Console" {
Ok(ChatFrom::Console)
} else {
value.as_str().try_into().map(ChatFrom::Player)
value.as_str().parse().map(ChatFrom::Player)
}
}
}
@ -454,7 +455,7 @@ impl<'de> Deserialize<'de> for MaybeSteamId {
let raw = <Cow<str> as Deserialize>::deserialize(deserializer)?;
match raw.as_ref() {
"BOT" => Ok(MaybeSteamId::Bot),
raw => SteamID::try_from(raw)
raw => SteamID::from_str(raw)
.map_err(D::Error::custom)
.map(MaybeSteamId::SteamId),
}