diff --git a/destruct.rs b/destruct.rs new file mode 100644 index 0000000..52a10a8 --- /dev/null +++ b/destruct.rs @@ -0,0 +1,19 @@ +struct Test { + value1: String, + value2: Vec, +} + +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); +}