提问人:vicky leu 提问时间:10/19/2023 更新时间:10/19/2023 访问量:46
如何取消引用切片引用
how can i dereference a slice reference
问:
我需要取消引用切片,然后使用变量 a。
let mut a: [i8; 10] = [42; 10];
a[5] = 0;
let mut s = &mut a[2..4];
s[0] = 100;
let mut aa = &mut *s;
aa[1] = 23;
let release = *aa;
println!(" s:{:#?} a:{:#?}", s, a);
我收到有关未知大小的编译时错误
error[E0277]: the size for values of type `[i8]` cannot be known at compilation time
let release = *aa;
^^^^^^^ doesn't have a size known at compile-time
取消引用切片引用
答: 暂无答案
评论
deref()
等效于您已经尝试过的 。&*