daily pastebin goal
76%
SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #[derive(Debug)]
  2. enum Mutant {
  3.     Val(usize),
  4. }
  5.  
  6. impl Mutant {
  7.     fn mutate(&mut self, new_val: usize) {
  8.         *self = Mutant::Val(new_val);
  9.     }
  10. }
  11.  
  12. fn main() {
  13.     let mut m = Mutant::Val(1);
  14.     eprintln!("{:?}", m);
  15.     m.mutate(2);
  16.     eprintln!("{:?}", m);
  17. }
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