Guest User

Untitled

a guest
Feb 15th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. struct X(Vec<u8>);
  2.  
  3. impl Drop for X {
  4. fn drop(&mut self) {}
  5. }
  6.  
  7. fn main() {
  8. let mut x = Some(X(vec![4]));
  9.  
  10. match &mut x {
  11. Some(X(list)) => {
  12. let list = std::mem::replace(list, Vec::new());
  13. println!("{:?}", list);
  14. // i want to own list here, not clone it
  15. }
  16. None => {}
  17. }
  18. }
Add Comment
Please, Sign In to add comment