Last active
September 14, 2015 04:30
-
-
Save ooooak/ef27c78b568f3fea6ce0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#[derive(Debug)] | |
enum Lx { | |
Str(String), | |
Int(String), | |
Keyword(String), | |
LxUnk(char), | |
} | |
fn main() { | |
let mut v: Vec<Lx> = vec![]; | |
v.push(Lx::Str("test".to_string())); | |
v.push(Lx::Int("124".to_string())); | |
v.push(Lx::Keyword("print".to_string())); | |
v.push(Lx::Str("test".to_string())); | |
for x in v.iter() { | |
let s = match x { | |
Lx::Str(c) => c, | |
Lx::Int(c) => c, | |
Lx::Keyword(c) => c, | |
_ => "".to_string(), | |
}; | |
println!("{:?}", s); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment