Skip to content

Instantly share code, notes, and snippets.

@dns2utf8
Created September 23, 2020 19:00
Show Gist options
  • Save dns2utf8/d7acd42d203a3a583f8d602c041de58f to your computer and use it in GitHub Desktop.
Save dns2utf8/d7acd42d203a3a583f8d602c041de58f to your computer and use it in GitHub Desktop.
// 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 */"); }
}
}
@dns2utf8
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment