Skip to content

Commit

Permalink
Merge pull request rust-phf#273 from drewkett/impl-phf-hash-for-slices
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor authored Nov 20, 2022
2 parents 1b88e07 + 272f3d7 commit 757012b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions phf_shared/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,30 @@ array_impl!(u128);
array_impl!(i128);
array_impl!(bool);
array_impl!(char);

macro_rules! slice_impl (
($t:ty) => {
impl PhfHash for [$t] {
#[inline]
fn phf_hash<H: Hasher>(&self, state: &mut H) {
for v in self {
v.phf_hash(state);
}
}
}
};
);

slice_impl!(i8);
slice_impl!(u16);
slice_impl!(i16);
slice_impl!(u32);
slice_impl!(i32);
slice_impl!(u64);
slice_impl!(i64);
slice_impl!(usize);
slice_impl!(isize);
slice_impl!(u128);
slice_impl!(i128);
slice_impl!(bool);
slice_impl!(char);

0 comments on commit 757012b

Please sign in to comment.