mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-23 11:19:47 +02:00
Opt: extract BattleResultsDat::from_reader
This commit is contained in:
1 parent
679b0ddadf
commit
6fb70da06f
2 files changed
+15
-4
No files matched your search
@@ -1,6 +1,17 @@
|
||||
use std::io::Read;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde_bytes::ByteBuf;
|
||||
|
||||
use crate::{Error, Result};
|
||||
|
||||
/// Represents un-pickled `battle_results.dat`.
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct BattleResultsDat(pub(crate) u64, pub(crate) ByteBuf);
|
||||
|
||||
impl BattleResultsDat {
|
||||
/// Try and parse the pickled structure from the reader which contains `battle_results.dat`.
|
||||
pub fn from_reader(reader: impl Read) -> Result<Self> {
|
||||
serde_pickle::from_reader(reader, Default::default()).map_err(Error::UnpickleFailed)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user