SHARE
TWEET

Untitled

a guest Sep 16th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #[derive(Debug)]
  2. enum AnnotationType {
  3.     A { a: u16 },
  4.     B { b: u32, c: u64 }
  5. }
  6.  
  7.  
  8. fn main() {
  9.     println!("Hello, world!");
  10.     let mut x: AnnotationType = AnnotationType::A { a: 12 };
  11.     test(&mut x);
  12.     println!("{:?}", x);
  13.    
  14.     x = AnnotationType::B { b: 13, c: 15 };
  15.     test(&mut x);
  16.     println!("{:?}", x);
  17. }
  18.  
  19. fn test(f: &mut AnnotationType) {
  20.     match f {
  21.         AnnotationType::A { mut a } => { a = 5 },
  22.         AnnotationType::B { mut b, mut c } => { b = 13; c = 15 },
  23.     };
  24. }
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