slice_mut for& mut [T]

时间:2014-10-04 16:03:52

标签: rust

为什么{amp; mut [T]没有实现MutableSlice::slice_mut

每晚0.12.0测试rustc(b2d4eb186 2014-10-02 15:57:19 +0000):

fn sort<T>(v: &mut [T]){
    let (l, r) = v.split_at_mut(2); // Ok
    let len = v.slice_mut(1u, 3u).len(); // error: type `&mut [T]` does not implement any method in scope named `slice_mut`
}

#[test]
fn it_works() {
    let mut v = [1i, 2, 3, 4, 5, 6];
    sort(v);
}

1 个答案:

答案 0 :(得分:2)