1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
pub extern crate std;
use std::hash::{Hash, Hasher};
use crate::parser::*;
macro_rules! fixed_len_struct_impl_hash {
(
$(#[$outer:meta])*
$type:ident[$size:expr];
) => {
impl<T: AsRef<[u8]>> Hash for $type<T> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.as_ref().hash(state);
}
}
};
}
fixed_len_struct_impl_hash! {
EUI64[8];
}
fixed_len_struct_impl_hash! {
DevNonce[2];
}
fixed_len_struct_impl_hash! {
AppNonce[3];
}
fixed_len_struct_impl_hash! {
DevAddr[4];
}
fixed_len_struct_impl_hash! {
NwkAddr[3];
}