daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest Aug 19th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #![feature(nll)]
  2.  
  3. #[derive(Debug)]
  4. struct K<'a> {
  5.     i: Option<&'a mut i32>,
  6. }
  7.  
  8. #[derive(Debug)]
  9. enum L<'a> {
  10.     Empty,
  11.     NotEmpty(&'a mut i32)
  12. }
  13.  
  14. fn main() {
  15.  
  16.     let mut a = 5;                      println!("{:?}", a);
  17.     let mut k = K{ i: Some(&mut a) };   println!("{:?}", k);
  18.     k.i = None;                         println!("{:?}", k);
  19.     a = 10;                             println!("{:?}", a);
  20.    
  21.     let mut b = 15;                     println!("{:?}", b);
  22.     let mut l = L::NotEmpty(&mut b);    println!("{:?}", l);      
  23.     l = L::Empty;                       println!("{:?}", l);    
  24.     b = 20;                             println!("{:?}", b);    
  25. }
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