Browse Source

Struct de-structuring test

master
Julio Biason 2 years ago
parent
commit
0ab7c6133d
  1. 19
      destruct.rs

19
destruct.rs

@ -0,0 +1,19 @@
struct Test {
value1: String,
value2: Vec<String>,
}
fn main() {
let a = Test {
value1: "string".into(),
value2: vec!["a".into(), "b".into()],
};
let Test {
value1,
value2: list,
} = a;
println!("Name: {:?}", value1);
println!("List: {:?}", list);
}
Loading…
Cancel
Save