Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: shorten map type alias names #824

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions crates/primitives/src/map/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ use core::{
};

/// [`HashMap`] optimized for hashing [fixed-size byte arrays](FixedBytes).
pub type FbHashMap<const N: usize, V> = HashMap<FixedBytes<N>, V, FbBuildHasher<N>>;
pub type FbMap<const N: usize, V> = HashMap<FixedBytes<N>, V, FbBuildHasher<N>>;
#[doc(hidden)]
pub type FbHashMap<const N: usize, V> = FbMap<N, V>;
/// [`HashSet`] optimized for hashing [fixed-size byte arrays](FixedBytes).
pub type FbHashSet<const N: usize> = HashSet<FixedBytes<N>, FbBuildHasher<N>>;
pub type FbSet<const N: usize> = HashSet<FixedBytes<N>, FbBuildHasher<N>>;
#[doc(hidden)]
pub type FbHashSet<const N: usize> = FbSet<N>;

cfg_if! {
if #[cfg(feature = "map-indexmap")] {
Expand All @@ -26,9 +30,13 @@ macro_rules! fb_alias_maps {
($($ty:ident < $n:literal >),* $(,)?) => { paste::paste! {
$(
#[doc = concat!("[`HashMap`] optimized for hashing [`", stringify!($ty), "`].")]
pub type [<$ty HashMap>]<V> = HashMap<$ty, V, FbBuildHasher<$n>>;
pub type [<$ty Map>]<V> = HashMap<$ty, V, FbBuildHasher<$n>>;
#[doc(hidden)]
pub type [<$ty HashMap>]<V> = [<$ty Map>]<V>;
#[doc = concat!("[`HashSet`] optimized for hashing [`", stringify!($ty), "`].")]
pub type [<$ty HashSet>] = HashSet<$ty, FbBuildHasher<$n>>;
pub type [<$ty Set>] = HashSet<$ty, FbBuildHasher<$n>>;
#[doc(hidden)]
pub type [<$ty HashSet>] = [<$ty Set>];

cfg_if! {
if #[cfg(feature = "map-indexmap")] {
Expand Down
Loading