use inherent method instead
This commit is contained in:
parent
8812c6bae9
commit
489101cc45
2 changed files with 22 additions and 15 deletions
|
|
@ -15,8 +15,7 @@ use std::cell::Cell;
|
|||
fn main() {
|
||||
let slice: &mut [i32] = &mut [1, 2, 3];
|
||||
let cell_slice: &Cell<[i32]> = Cell::from_mut(slice);
|
||||
assert_eq!(cell_slice[..].len(), 3);
|
||||
let slice_cell: &[Cell<i32>] = cell_slice.as_slice_of_cells();
|
||||
|
||||
let sub_slice: &[Cell<i32>] = &cell_slice[1..];
|
||||
assert_eq!(sub_slice.len(), 2);
|
||||
assert_eq!(slice_cell.len(), 3);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue