From e39837aba9a21d4c4ffac243675862422255ca00 Mon Sep 17 00:00:00 2001 From: lenny4 Date: Sun, 7 Dec 2025 19:40:02 +0100 Subject: [PATCH] upgrade dependencies --- .gitignore | 1 + Cargo.toml | 6 +++--- src/action_tree.rs | 9 ++++++--- src/file.rs | 4 ++-- src/game/serialization.rs | 6 +++--- src/mutex_like.rs | 8 ++++---- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 96ef6c0b..408b8a57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target Cargo.lock +.idea \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index f4ccf76d..4c2d75b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,10 +9,10 @@ repository = "https://github.com/b-inary/postflop-solver" license = "AGPL-3.0-or-later" [dependencies] -bincode = { version = "2.0.0-rc.3", optional = true } +bincode = { version = "2.0.1", optional = true } once_cell = "1.18.0" -rayon = { version = "1.8.0", optional = true } -regex = "1.9.6" +rayon = { version = "1.11.0", optional = true } +regex = "1.12.2" zstd = { version = "0.12.4", optional = true, default-features = false } [features] diff --git a/src/action_tree.rs b/src/action_tree.rs index 8366c123..2b546007 100644 --- a/src/action_tree.rs +++ b/src/action_tree.rs @@ -390,10 +390,12 @@ impl ActionTree { let mut node = &*self.root.lock() as *const ActionTreeNode; for action in &self.history { while (*node).is_chance() { - node = &*(*node).children[0].lock(); + let node_ref = &*node; + node = &*node_ref.children[0].lock(); } let index = (*node).actions.iter().position(|x| x == action).unwrap(); - node = &*(*node).children[index].lock(); + let node_ref = &*node; + node = &*node_ref.children[index].lock(); } &*node } @@ -405,7 +407,8 @@ impl ActionTree { unsafe { let mut node = self.current_node() as *const ActionTreeNode; while (*node).is_chance() { - node = &*(*node).children[0].lock(); + let node_ref = &*node; + node = &*node_ref.children[0].lock(); } &*node } diff --git a/src/file.rs b/src/file.rs index 17e7d5b2..456402b4 100644 --- a/src/file.rs +++ b/src/file.rs @@ -27,7 +27,7 @@ pub enum DataType { } /// A trait for data that can be saved into a file. -pub trait FileData: Decode + Encode { +pub trait FileData: Decode<()> + Encode { #[doc(hidden)] fn data_type() -> DataType; #[doc(hidden)] @@ -139,7 +139,7 @@ pub fn save_data_to_file>( save_data_into_std_write(data, memo, &mut writer, compression_level) } -fn decode_from_std_read(reader: &mut R, err_msg: &str) -> Result { +fn decode_from_std_read< D: Decode<()>, R: Read>(reader: &mut R, err_msg: &str) -> Result { bincode::decode_from_std_read(reader, bincode::config::standard()) .map_err(|e| format!("{}: {}", err_msg, e)) } diff --git a/src/game/serialization.rs b/src/game/serialization.rs index 951c7854..1eb33a49 100644 --- a/src/game/serialization.rs +++ b/src/game/serialization.rs @@ -174,8 +174,8 @@ impl Encode for PostFlopGame { } } -impl Decode for PostFlopGame { - fn decode(decoder: &mut D) -> Result { +impl Decode<()> for PostFlopGame { + fn decode>(decoder: &mut D) -> Result { // version check let version = String::decode(decoder)?; if version != VERSION_STR { @@ -292,7 +292,7 @@ impl Encode for PostFlopNode { } } -impl Decode for PostFlopNode { +impl Decode<()> for PostFlopNode { fn decode(decoder: &mut D) -> Result { // node instance let mut node = Self { diff --git a/src/mutex_like.rs b/src/mutex_like.rs index 39b573f6..b6b74ec8 100644 --- a/src/mutex_like.rs +++ b/src/mutex_like.rs @@ -99,17 +99,17 @@ impl Encode for MutexLike { } #[cfg(feature = "bincode")] -impl Decode for MutexLike { +impl> Decode for MutexLike where { #[inline] - fn decode(decoder: &mut D) -> Result { + fn decode>(decoder: &mut D) -> Result { Ok(Self::new(T::decode(decoder)?)) } } #[cfg(feature = "bincode")] -impl<'de, T: BorrowDecode<'de>> BorrowDecode<'de> for MutexLike { +impl<'de, Context, T: BorrowDecode<'de, Context>> BorrowDecode<'de, Context> for MutexLike { #[inline] - fn borrow_decode>(decoder: &mut D) -> Result { + fn borrow_decode>(decoder: &mut D) -> Result { Ok(Self::new(T::borrow_decode(decoder)?)) } }