Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct X(Vec<u8>);
- impl Drop for X {
- fn drop(&mut self) {}
- }
- fn main() {
- let mut x = Some(X(vec![4]));
- match &mut x {
- Some(X(list)) => {
- let list = std::mem::replace(list, Vec::new());
- println!("{:?}", list);
- // i want to own list here, not clone it
- }
- None => {}
- }
- }
Add Comment
Please, Sign In to add comment