File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1211,6 +1211,17 @@ impl<'a> Extend<&'a u8> for BytesMut {
1211
1211
}
1212
1212
}
1213
1213
1214
+ impl Extend < Bytes > for BytesMut {
1215
+ fn extend < T > ( & mut self , iter : T )
1216
+ where
1217
+ T : IntoIterator < Item = Bytes > ,
1218
+ {
1219
+ for bytes in iter {
1220
+ self . extend_from_slice ( & bytes)
1221
+ }
1222
+ }
1223
+ }
1224
+
1214
1225
impl FromIterator < u8 > for BytesMut {
1215
1226
fn from_iter < T : IntoIterator < Item = u8 > > ( into_iter : T ) -> Self {
1216
1227
BytesMut :: from_vec ( Vec :: from_iter ( into_iter) )
Original file line number Diff line number Diff line change @@ -544,6 +544,13 @@ fn extend_from_slice_mut() {
544
544
}
545
545
}
546
546
547
+ #[ test]
548
+ fn extend_mut_from_bytes ( ) {
549
+ let mut bytes = BytesMut :: with_capacity ( 0 ) ;
550
+ bytes. extend ( [ Bytes :: from ( LONG ) ] ) ;
551
+ assert_eq ! ( * bytes, LONG [ ..] ) ;
552
+ }
553
+
547
554
#[ test]
548
555
fn extend_mut_without_size_hint ( ) {
549
556
let mut bytes = BytesMut :: with_capacity ( 0 ) ;
You can’t perform that action at this time.
0 commit comments