Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement