impl Deref instead of Index
This commit is contained in:
parent
4d99957ce3
commit
bdf86300b4
2 changed files with 9 additions and 10 deletions
|
|
@ -15,6 +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 sub_slice : &[Cell<i32>] = &cell_slice[1..];
|
||||
assert_eq!(sub_slice.len(), 2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue