Rust 有没有更多的方法可以使用。。(dotdot)除了范围以外的锈迹?
我发现。。可以通过以下方式在结构中使用:Rust 有没有更多的方法可以使用。。(dotdot)除了范围以外的锈迹?,rust,Rust,我发现。。可以通过以下方式在结构中使用: struct Test { e1: i32, e2: i32, } fn main() { let test = Test { e1: 1, e2: 2 }; let Test { e1: x, .. } = test; let Test { e2: y, .. } = test; let test2 = Test { ..test }; let test3 = Test { e1: 2, e2:
struct Test {
e1: i32,
e2: i32,
}
fn main() {
let test = Test { e1: 1, e2: 2 };
let Test { e1: x, .. } = test;
let Test { e2: y, .. } = test;
let test2 = Test { ..test };
let test3 = Test { e1: 2, e2: 3, ..test };
}
有没有更多的方法来使用。。?有关于它们的概述吗?没有,正如您所看到的,没有其他用法: ..,expr…,…expr,expr..expr:右排他范围文字。 ..expr:struct literal更新语法。 variantx,…,struct_type{x,…}:“和其他”模式绑定。
标题中的问题与底部的问题不匹配。-我想这是最后一次了。。