File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1
1
use alloc:: collections:: VecDeque ;
2
+ #[ cfg( feature = "std" ) ]
3
+ use std:: io;
2
4
3
5
use super :: Buf ;
4
6
@@ -16,6 +18,22 @@ impl Buf for VecDeque<u8> {
16
18
}
17
19
}
18
20
21
+ #[ cfg( feature = "std" ) ]
22
+ fn chunks_vectored < ' a > ( & ' a self , dst : & mut [ io:: IoSlice < ' a > ] ) -> usize {
23
+ if self . is_empty ( ) || dst. is_empty ( ) {
24
+ return 0 ;
25
+ }
26
+
27
+ let ( s1, s2) = self . as_slices ( ) ;
28
+ dst[ 0 ] = io:: IoSlice :: new ( s1) ;
29
+ if s2. is_empty ( ) || dst. len ( ) == 1 {
30
+ return 1 ;
31
+ }
32
+
33
+ dst[ 1 ] = io:: IoSlice :: new ( s2) ;
34
+ 2
35
+ }
36
+
19
37
fn advance ( & mut self , cnt : usize ) {
20
38
self . drain ( ..cnt) ;
21
39
}
Original file line number Diff line number Diff line change @@ -353,7 +353,7 @@ mod vec_deque {
353
353
deque
354
354
}
355
355
356
- buf_tests ! ( make_input, /* `VecDeque` does not do `chucks_vectored */ false ) ;
356
+ buf_tests ! ( make_input, true ) ;
357
357
}
358
358
359
359
#[ cfg( feature = "std" ) ]
You can’t perform that action at this time.
0 commit comments