File tree Expand file tree Collapse file tree 2 files changed +18
-16
lines changed Expand file tree Collapse file tree 2 files changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -83,12 +83,6 @@ impl fmt::Debug for Binary {
83
83
}
84
84
}
85
85
86
- impl From < & [ u8 ] > for Binary {
87
- fn from ( binary : & [ u8 ] ) -> Self {
88
- Self ( binary. to_vec ( ) )
89
- }
90
- }
91
-
92
86
/// Just like Vec<u8>, Binary is a smart pointer to [u8].
93
87
/// This implements `*binary` for us and allows us to
94
88
/// do `&*binary`, returning a `&[u8]` from a `&Binary`.
@@ -102,14 +96,21 @@ impl Deref for Binary {
102
96
}
103
97
}
104
98
105
- // Reference
99
+ // Slice
100
+ impl From < & [ u8 ] > for Binary {
101
+ fn from ( binary : & [ u8 ] ) -> Self {
102
+ Self ( binary. to_vec ( ) )
103
+ }
104
+ }
105
+
106
+ // Array reference
106
107
impl < const LENGTH : usize > From < & [ u8 ; LENGTH ] > for Binary {
107
108
fn from ( source : & [ u8 ; LENGTH ] ) -> Self {
108
109
Self ( source. to_vec ( ) )
109
110
}
110
111
}
111
112
112
- // Owned
113
+ // Owned array
113
114
impl < const LENGTH : usize > From < [ u8 ; LENGTH ] > for Binary {
114
115
fn from ( source : [ u8 ; LENGTH ] ) -> Self {
115
116
Self ( source. into ( ) )
Original file line number Diff line number Diff line change @@ -79,12 +79,6 @@ impl fmt::Debug for HexBinary {
79
79
}
80
80
}
81
81
82
- impl From < & [ u8 ] > for HexBinary {
83
- fn from ( binary : & [ u8 ] ) -> Self {
84
- Self ( binary. to_vec ( ) )
85
- }
86
- }
87
-
88
82
/// Just like Vec<u8>, HexBinary is a smart pointer to [u8].
89
83
/// This implements `*data` for us and allows us to
90
84
/// do `&*data`, returning a `&[u8]` from a `&HexBinary`.
@@ -98,14 +92,21 @@ impl Deref for HexBinary {
98
92
}
99
93
}
100
94
101
- // Reference
95
+ // Slice
96
+ impl From < & [ u8 ] > for HexBinary {
97
+ fn from ( binary : & [ u8 ] ) -> Self {
98
+ Self ( binary. to_vec ( ) )
99
+ }
100
+ }
101
+
102
+ // Array reference
102
103
impl < const LENGTH : usize > From < & [ u8 ; LENGTH ] > for HexBinary {
103
104
fn from ( source : & [ u8 ; LENGTH ] ) -> Self {
104
105
Self ( source. to_vec ( ) )
105
106
}
106
107
}
107
108
108
- // Owned
109
+ // Owned array
109
110
impl < const LENGTH : usize > From < [ u8 ; LENGTH ] > for HexBinary {
110
111
fn from ( source : [ u8 ; LENGTH ] ) -> Self {
111
112
Self ( source. into ( ) )
You can’t perform that action at this time.
0 commit comments