SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. enum Valore {
  2.     Esempio, Ciao, Prova
  3. }
  4.  
  5. impl Valore {
  6.     fn handle(&self, param: i32) {
  7.         match self {
  8.             Valore::Esempio => handle_esempio(param),
  9.             Valore::Ciao => handle_ciao(param),
  10.             Valore::Prova => handle_prova(param)
  11.         }
  12.     }
  13. }
  14.  
  15. fn handle_esempio(fai_qualcosa:i32){
  16.     /* qualcosa*/
  17. }
  18.  
  19. fn handle_ciao(fai_qualcosa:i32){
  20.     /* qualcosa*/
  21. }
  22.  
  23. fn handle_prova(fai_qualcosa:i32){
  24.     /* qualcosa*/
  25. }
  26.  
  27. fn main(){
  28.     Valore::Esempio.handle(5);
  29. }
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