Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct S {
- id: String,
- }
- fn main() {
- let mut ss = vec![S{id: "hello".to_owned()}, S{id: "world".to_owned()}];
- let mut magic = None;
- magic = ss.pop().map(|x| x.id);
- assert_eq!(magic, Some("world".to_owned()));
- }
Add Comment
Please, Sign In to add comment