size_of/support/
ahash.rs

1#![cfg(feature = "ahash")]
2
3use ahash::{AHasher, RandomState};
4
5impl_total_size_childless! {
6    AHasher,
7    RandomState,
8}
9
10// `ahash::{AHashMap, AHashSet}` just deref into std maps & sets
11#[cfg(feature = "ahash-std")]
12mod ahash_std {
13    use crate::{Context, SizeOf};
14    use ahash::{AHashMap, AHashSet};
15    use std::ops::Deref;
16
17    impl<K, V, S> SizeOf for AHashMap<K, V, S>
18    where
19        K: SizeOf,
20        V: SizeOf,
21        S: SizeOf,
22    {
23        #[inline]
24        fn size_of_children(&self, context: &mut Context) {
25            self.deref().size_of_children(context);
26        }
27    }
28
29    impl<K, S> SizeOf for AHashSet<K, S>
30    where
31        K: SizeOf,
32        S: SizeOf,
33    {
34        #[inline]
35        fn size_of_children(&self, context: &mut Context) {
36            self.deref().size_of_children(context);
37        }
38    }
39}