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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Indicator(pub [u8; 2]);
impl Indicator {
pub fn from_slice(bytes: &[u8]) -> Self {
let mut this = Indicator([0; 2]);
this.0.copy_from_slice(bytes);
this
}
}
impl AsRef<[u8]> for Indicator {
fn as_ref(&self) -> &[u8] {
&self.0[..]
}
}
impl From<[u8; 2]> for Indicator {
fn from(s: [u8; 2]) -> Indicator {
Indicator(s)
}
}
impl From<&'_ [u8; 2]> for Indicator {
fn from(s: &'_ [u8; 2]) -> Indicator {
Indicator(*s)
}
}
impl PartialEq<[u8; 2]> for Indicator {
fn eq(&self, other: &[u8; 2]) -> bool {
self.0 == *other
}
}
impl PartialEq<&'_ [u8; 2]> for Indicator {
fn eq(&self, other: &&'_ [u8; 2]) -> bool {
&self.0 == *other
}
}
impl PartialEq<[u8]> for Indicator {
fn eq(&self, other: &[u8]) -> bool {
&self.0[..] == other
}
}
impl PartialEq<&'_ [u8]> for Indicator {
fn eq(&self, other: &&'_ [u8]) -> bool {
&self.0[..] == *other
}
}
impl PartialEq<str> for Indicator {
fn eq(&self, other: &str) -> bool {
&self.0[..] == other.as_bytes()
}
}
impl PartialEq<&'_ str> for Indicator {
fn eq(&self, other: &&'_ str) -> bool {
&self.0[..] == other.as_bytes()
}
}
impl PartialEq<Indicator> for [u8; 2] {
fn eq(&self, other: &Indicator) -> bool {
*other == *self
}
}
impl PartialEq<Indicator> for &'_ [u8; 2] {
fn eq(&self, other: &Indicator) -> bool {
*other == *self
}
}
impl PartialEq<Indicator> for [u8] {
fn eq(&self, other: &Indicator) -> bool {
*other == *self
}
}
impl PartialEq<Indicator> for &'_ [u8] {
fn eq(&self, other: &Indicator) -> bool {
*other == *self
}
}
impl PartialEq<Indicator> for str {
fn eq(&self, other: &Indicator) -> bool {
*other == *self
}
}
impl PartialEq<Indicator> for &'_ str {
fn eq(&self, other: &Indicator) -> bool {
*other == *self
}
}