Created
September 23, 2020 19:00
-
-
Save dns2utf8/d7acd42d203a3a583f8d602c041de58f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: https://estada.ch/2020/9/23/my-rust-2021-wishlist-for-the-2021-roadmap/#adl | |
#[derive(Debug)] | |
pub enum SecondaryProcessor { | |
Opening(String), | |
Ready, | |
Writing(String), | |
Reading(String), | |
Closing, | |
} | |
fn main() { | |
use SecondaryProcessor::*; | |
let s = Ready; | |
match s { | |
Opening(string) => { println!("Opening: {}", string); } | |
Ready | Closing => { println!("Ready or Closing"); } | |
others => { println!("{:?}", others); } | |
_ => { println!("/* do something */"); } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run it on play.rust-lang.org