Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. struct Foo {
  2. a: Option<String>,
  3. }
  4.  
  5. fn bar(a: &mut Foo, b: &mut String) {
  6. unimplemented!()
  7. }
  8.  
  9. impl Foo {
  10. fn bar(&mut self) {
  11. if let Some(mut a) = self.a.take() {
  12. bar(self, &mut a);
  13. self.a.replace(a);
  14. }
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement