File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 1
- use std:: {
2
- fs:: { File , OpenOptions } ,
3
- ops:: { Deref , DerefMut } ,
4
- path:: Path ,
5
- } ;
1
+ use std:: fs:: { File , OpenOptions } ;
2
+ use std:: ops:: { Deref , DerefMut } ;
3
+ use std:: path:: Path ;
6
4
7
5
use bytemuck:: Pod ;
8
6
use color_eyre:: eyre:: bail;
@@ -242,17 +240,29 @@ mod tests {
242
240
#[ test]
243
241
fn test_mmap_vec ( ) {
244
242
let f = tempfile:: tempfile ( ) . unwrap ( ) ;
243
+
245
244
let mut storage: MmapVec < u32 > = unsafe { MmapVec :: create ( f. try_clone ( ) . unwrap ( ) ) . unwrap ( ) } ;
246
245
246
+ println ! ( "{storage:?}" ) ;
247
247
storage. resize ( 2 ) ;
248
+ println ! ( "{storage:?}" ) ;
248
249
249
250
storage. push ( u32:: MAX ) ;
251
+ println ! ( "{storage:?}" ) ;
250
252
storage. push ( 2 ) ;
253
+ println ! ( "{storage:?}" ) ;
254
+
255
+ storage. resize ( 4 ) ;
256
+ println ! ( "{storage:?}" ) ;
257
+
251
258
storage. push ( 42 ) ;
259
+ println ! ( "{storage:?}" ) ;
252
260
storage. push ( 4 ) ;
261
+ println ! ( "{storage:?}" ) ;
253
262
254
263
assert_eq ! ( storage. len( ) , 4 ) ;
255
264
265
+ println ! ( "{storage:?}" ) ;
256
266
assert_eq ! ( storage[ 0 ] , u32 :: MAX ) ;
257
267
assert_eq ! ( storage[ 1 ] , 2 ) ;
258
268
assert_eq ! ( storage[ 2 ] , 42 ) ;
You can’t perform that action at this time.
0 commit comments