You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace all {Hash,BTree}{Map,Set} with their equivalent in alloy_primitives::map, as explained below. This both improves performance and is more compatible with no_std, as the fallback will be using hashbrown when "std" is not enabled.
std::collections::{BTreeMap, BTreeSet} -> refer to 1. above
IMPORTANT: this is not an equivalent conversion because BTree iteration is guaranteed to be sorted, while HashMap iteration depends on the hash value which is random/changes across runs; only do this if iteration order does not matter!
If iteration affects user-facing output, or serialization, e.g. in types implementing serde::Serialize, BTree should be replaced with the Index* equivalents so as to have a consistent iteration order, rather than random; this requires the "map-index" feature.
If sorted iteration matters, or BTree specific methods are used, such as split_off, then there is nothing to do.
When in doubt, it's OK to leave it and we can revisit it at a later point.
The minimum alloy-primitives version should also be bumped to 0.8.4.
Replace all
{Hash,BTree}{Map,Set}
with their equivalent inalloy_primitives::map
, as explained below. This both improves performance and is more compatible withno_std
, as the fallback will be usinghashbrown
when"std"
is not enabled.Migration guide:
std::collections::{HashMap, HashSet}
->alloy_primitives::map::{HashMap, HashSet}
; unless:Selector
,Address
, orB256
, then usealloy_primitives::map::{<Name>{HashMap,HashSet}}
, e.g.AddressHashMap
B*
orFixedBytes
, then usealloy_primitives::map::{FbHashMap, FbHashSet}
std::collections::{hash_map, hash_set}
->alloy_primitives::map::{hash_map, hash_set}
std::collections::{BTreeMap, BTreeSet}
-> refer to 1. aboveserde::Serialize
, BTree should be replaced with the Index* equivalents so as to have a consistent iteration order, rather than random; this requires the"map-index"
feature.split_off
, then there is nothing to do.The minimum
alloy-primitives
version should also be bumped to0.8.4
.Additional context
map
module core#743alloy_primitives::map
alloy#1365The text was updated successfully, but these errors were encountered: