daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Jul 18th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fn main() {
  2.     println!("Hello, world!");
  3.     Foo::new(Baz("borrow")).run();
  4. }
  5.  
  6. struct Baz<'a>(&'a str);
  7.  
  8. struct Foo<'a> {
  9.     baz: Baz<'a>,
  10. }
  11.  
  12. impl<'a> Foo<'a> {
  13.     fn new(baz: Baz<'a>) -> Foo<'a> {
  14.         Self {
  15.             baz,
  16.             bar: "a".to_string(),
  17.         }
  18.     }
  19.     fn run(&mut self) {
  20.         Qux {
  21.             mut_baz: &mut self.baz,
  22.         };
  23.     }
  24. }
  25.  
  26. struct Qux<'a> {
  27.     mut_baz: &'a mut Baz<'a>,
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top