File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 29
29
#![ feature( binary_heap_as_slice) ]
30
30
#![ feature( inplace_iteration) ]
31
31
#![ feature( iter_advance_by) ]
32
+ #![ feature( iter_next_chunk) ]
32
33
#![ feature( round_char_boundary) ]
33
34
#![ feature( slice_group_by) ]
34
35
#![ feature( slice_partition_dedup) ]
Original file line number Diff line number Diff line change 1
1
use core:: alloc:: { Allocator , Layout } ;
2
+ use core:: iter:: IntoIterator ;
2
3
use core:: ptr:: NonNull ;
3
4
use std:: alloc:: System ;
4
5
use std:: assert_matches:: assert_matches;
@@ -930,6 +931,15 @@ fn test_into_iter_count() {
930
931
assert_eq ! ( [ 1 , 2 , 3 ] . into_iter( ) . count( ) , 3 ) ;
931
932
}
932
933
934
+ #[ test]
935
+ fn test_into_iter_next_chunk ( ) {
936
+ let mut iter = b"lorem" . to_vec ( ) . into_iter ( ) ;
937
+
938
+ assert_eq ! ( iter. next_chunk( ) . unwrap( ) , [ b'l' , b'o' ] ) ; // N is inferred as 2
939
+ assert_eq ! ( iter. next_chunk( ) . unwrap( ) , [ b'r' , b'e' , b'm' ] ) ; // N is inferred as 3
940
+ assert_eq ! ( iter. next_chunk:: <4 >( ) . unwrap_err( ) . as_slice( ) , & [ ] ) ; // N is explicitly 4
941
+ }
942
+
933
943
#[ test]
934
944
fn test_into_iter_clone ( ) {
935
945
fn iter_equal < I : Iterator < Item = i32 > > ( it : I , slice : & [ i32 ] ) {
You can’t perform that action at this time.
0 commit comments