64
64
//! read/write goes beyond the boundaries of a slice. Callers must take the necessary precautions
65
65
//! to avoid panics.
66
66
67
+ use std:: fmt:: Debug ;
67
68
use std:: marker:: PhantomData ;
68
69
use std:: ops:: { Deref , DerefMut } ;
69
70
@@ -151,12 +152,13 @@ impl<'a> NetworkBytesMut for &'a mut [u8] {}
151
152
// This struct is used as a convenience for any type which contains a generic member implementing
152
153
// NetworkBytes with a lifetime, so we don't have to also add the PhantomData member each time. We
153
154
// use pub(super) here because we only want this to be usable by the child modules of `pdu`.
155
+ #[ derive( Debug ) ]
154
156
pub ( super ) struct InnerBytes < ' a , T : ' a > {
155
157
bytes : T ,
156
158
phantom : PhantomData < & ' a T > ,
157
159
}
158
160
159
- impl < ' a , T > InnerBytes < ' a , T > {
161
+ impl < ' a , T : Debug > InnerBytes < ' a , T > {
160
162
/// Creates a new instance as a wrapper around `bytes`.
161
163
#[ inline]
162
164
pub fn new ( bytes : T ) -> Self {
@@ -167,7 +169,7 @@ impl<'a, T> InnerBytes<'a, T> {
167
169
}
168
170
}
169
171
170
- impl < ' a , T : Deref < Target = [ u8 ] > > Deref for InnerBytes < ' a , T > {
172
+ impl < ' a , T : Deref < Target = [ u8 ] > + Debug > Deref for InnerBytes < ' a , T > {
171
173
type Target = [ u8 ] ;
172
174
173
175
#[ inline]
@@ -176,21 +178,21 @@ impl<'a, T: Deref<Target = [u8]>> Deref for InnerBytes<'a, T> {
176
178
}
177
179
}
178
180
179
- impl < ' a , T : DerefMut < Target = [ u8 ] > > DerefMut for InnerBytes < ' a , T > {
181
+ impl < ' a , T : DerefMut < Target = [ u8 ] > + Debug > DerefMut for InnerBytes < ' a , T > {
180
182
#[ inline]
181
183
fn deref_mut ( & mut self ) -> & mut [ u8 ] {
182
184
self . bytes . deref_mut ( )
183
185
}
184
186
}
185
187
186
- impl < ' a , T : NetworkBytes > NetworkBytes for InnerBytes < ' a , T > {
188
+ impl < ' a , T : NetworkBytes + Debug > NetworkBytes for InnerBytes < ' a , T > {
187
189
#[ inline]
188
190
fn shrink_unchecked ( & mut self , len : usize ) {
189
191
self . bytes . shrink_unchecked ( len) ;
190
192
}
191
193
}
192
194
193
- impl < ' a , T : NetworkBytesMut > NetworkBytesMut for InnerBytes < ' a , T > { }
195
+ impl < ' a , T : NetworkBytesMut + Debug > NetworkBytesMut for InnerBytes < ' a , T > { }
194
196
195
197
#[ cfg( test) ]
196
198
mod tests {
0 commit comments