concread/internals/hashmap/
macros.rs1macro_rules! hash_key {
2 ($self:expr, $k:expr) => {{
3 let mut hasher = $self.build_hasher.build_hasher();
4 $k.hash(&mut hasher);
5 hasher.finish()
6 }};
7}
8
9macro_rules! debug_assert_leaf {
10 ($x:expr) => {{
11 debug_assert!(unsafe { $x.ctrl.a.0.is_leaf() });
12 }};
13}
14
15macro_rules! debug_assert_branch {
16 ($x:expr) => {{
17 debug_assert!(unsafe { $x.ctrl.a.0.is_branch() });
18 }};
19}
20
21macro_rules! self_meta {
22 ($x:expr) => {{
23 #[allow(unused_unsafe)]
24 unsafe {
25 &mut *($x as *mut Meta)
26 }
27 }};
28}
29
30macro_rules! branch_ref {
31 ($x:expr, $k:ty, $v:ty) => {{
32 #[allow(unused_unsafe)]
33 unsafe {
34 debug_assert!(unsafe { (&(*$x).ctrl.a).0.is_branch() });
35 &mut *($x as *mut Branch<$k, $v>)
36 }
37 }};
38}
39
40macro_rules! leaf_ref {
41 ($x:expr, $k:ty, $v:ty) => {{
42 #[allow(unused_unsafe)]
43 unsafe {
44 debug_assert!(unsafe { (&(*$x).ctrl.a).0.is_leaf() });
45 &mut *($x as *mut Leaf<$k, $v>)
46 }
47 }};
48}