daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Dec 14th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. struct Foo {
  2. }
  3.  
  4. enum FooChain<'a> {
  5.     Top(&'a mut Foo),
  6.     Child(&'a mut FooChain<'a>)
  7. }
  8.  
  9. impl<'a> FooChain<'a> {
  10.     fn child(&'a mut self) -> FooChain<'a> {
  11.         FooChain::Child(self)
  12.     }
  13. }
  14.  
  15. fn foo<'a>(chain : &'a mut FooChain<'a>) {
  16.     chain.child();
  17. }
  18.  
  19. fn main() {
  20.  
  21.     let mut a = Foo {};
  22.    
  23.     {
  24.         let mut b = FooChain::Top(&mut a);
  25.         foo(&mut b);
  26.         foo(&mut b);
  27.     }
  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