diff --git a/Cargo.lock b/Cargo.lock index 47f3a0277..bb92ae56e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,6 +86,12 @@ dependencies = [ "derive_arbitrary", ] +[[package]] +name = "archery" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae2ed21cd55021f05707a807a5fc85695dafb98832921f6cfa06db67ca5b869" + [[package]] name = "ark-bn254" version = "0.4.0" @@ -458,6 +464,12 @@ dependencies = [ "typenum", ] +[[package]] +name = "bitmaps" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d084b0137aaa901caf9f1e8b21daa6aa24d41cd806e111335541eff9683bd6" + [[package]] name = "bitvec" version = "1.0.1" @@ -1773,9 +1785,9 @@ version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" dependencies = [ - "bitmaps", + "bitmaps 2.1.0", "rand_core 0.6.4", - "rand_xoshiro", + "rand_xoshiro 0.6.0", "rayon", "serde", "sized-chunks", @@ -1783,6 +1795,31 @@ dependencies = [ "version_check", ] +[[package]] +name = "imbl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33afdc5d333c1a43f1f640bfc6ad3788729e5b2f18472e5d33a9187315257f8e" +dependencies = [ + "archery", + "bitmaps 3.2.1", + "imbl-sized-chunks", + "rand_core 0.9.3", + "rand_xoshiro 0.7.0", + "rayon", + "serde", + "version_check", +] + +[[package]] +name = "imbl-sized-chunks" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f4241005618a62f8d57b2febd02510fb96e0137304728543dfc5fd6f052c22d" +dependencies = [ + "bitmaps 3.2.1", +] + [[package]] name = "indexmap" version = "2.7.1" @@ -2452,6 +2489,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xoshiro" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f703f4665700daf5512dcca5f43afa6af89f09db47fb56be587f80636bda2d41" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.10.0" @@ -2895,7 +2941,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" dependencies = [ - "bitmaps", + "bitmaps 2.1.0", "typenum", ] @@ -3367,6 +3413,7 @@ dependencies = [ "bytes", "dashmap", "im", + "imbl", "log", "memmap2", "rand 0.9.2", diff --git a/Cargo.toml b/Cargo.toml index 5f4cf6b18..6b1f64eac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -180,6 +180,7 @@ group = "0.13.0" hex = "0.4.3" hmac = "0.12.1" im = "15.1.0" +imbl = ">= 6.0.0, < 8.0.0" # agave needs v7 for perf, but sdk needs v6 for min rust version 1.81; change to "7.0.0" when sdk >= rust 1.85 indicatif = "0.18.4" itertools = "0.12.1" js-sys = "0.3.77" diff --git a/frozen-abi/Cargo.toml b/frozen-abi/Cargo.toml index 4b9feb79d..23352e9fa 100644 --- a/frozen-abi/Cargo.toml +++ b/frozen-abi/Cargo.toml @@ -39,6 +39,7 @@ thiserror = { workspace = true } # to avoid version skew and keep digest computation stable regardless of consumer dependencies. bincode = "1.3.3" im = { workspace = true, features = ["rayon", "serde"] } +imbl = { workspace = true, features = ["rayon", "serde"] } memmap2 = { workspace = true } # These dependencies are used only to back `frozen-abi` StableAbi API, # to avoid version skew and keep digest computation stable regardless of consumer dependencies. diff --git a/frozen-abi/src/abi_example.rs b/frozen-abi/src/abi_example.rs index 51c4dbbef..75d0a878c 100644 --- a/frozen-abi/src/abi_example.rs +++ b/frozen-abi/src/abi_example.rs @@ -431,6 +431,21 @@ impl< } } +#[cfg(not(target_os = "solana"))] +impl AbiExample for imbl::GenericHashMap +where + K: Clone + Eq + std::hash::Hash + AbiExample, + V: Clone + AbiExample, + S: Clone + std::hash::BuildHasher + Default, + P: imbl::shared_ptr::SharedPointerKind, +{ + fn example() -> Self { + let mut map = Self::default(); + map.insert(K::example(), V::example()); + map + } +} + impl AbiExample for BTreeMap { fn example() -> Self { println!("AbiExample for (BTreeMap): {}", type_name::());