Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Foo {
- a: Option<String>,
- }
- fn bar(a: &mut Foo, b: &mut String) {
- unimplemented!()
- }
- impl Foo {
- fn bar(&mut self) {
- if let Some(mut a) = self.a.take() {
- bar(self, &mut a);
- self.a.replace(a);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement