SHARE
TWEET

Untitled

a guest May 20th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pub enum Data {
  2.     Var1,
  3.     Var2,
  4. }
  5.  
  6. pub fn show_data(a: Data, b: usize) -> usize {
  7.     match (a, b) {
  8.         (Data::Var1, 10) => 1,
  9.         (Data::Var1, 20) => 2,
  10.         (Data::Var1, 30) => 3,
  11.         (Data::Var2, 10) => 4,
  12.         (Data::Var2, 20) => 5,
  13.         (Data::Var2, 30) => 6,
  14.         _ => unreachable!()
  15.     }
  16. }
  17.  
  18. fn main() {
  19.     let a = Data::Var2;
  20.     let b: usize = 10;
  21.     let result = show_data(a, b);
  22.     println!("{}", result);
  23. }
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