Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug)]
- enum AnnotationType {
- A { a: u16 },
- B { b: u32, c: u64 }
- }
- fn main() {
- println!("Hello, world!");
- let mut x: AnnotationType = AnnotationType::A { a: 12 };
- test(&mut x);
- println!("{:?}", x);
- x = AnnotationType::B { b: 13, c: 15 };
- test(&mut x);
- println!("{:?}", x);
- }
- fn test(f: &mut AnnotationType) {
- match f {
- AnnotationType::A { mut a } => { a = 5 },
- AnnotationType::B { mut b, mut c } => { b = 13; c = 15 },
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement