Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Foo {
- s: String
- }
- fn main() {
- let dest: &mut Vec<&str> = &mut Vec::new();
- let source: Vec<Foo> = vec![
- Foo { s: String::from("example") },
- Foo { s: String::from("with") },
- Foo { s: String::from("vector") }
- ];
- for a in source {
- match a {
- Foo {s} => dest.push(s.as_str())
- }
- }
- println!("{:?}", dest);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement