Hello I am new to rust and just exploring how to use enums. I have simple code which has enum.
#[derive(Debug)]
enum Thing {
Str(String),
Boolean(bool)
}
fn run() -> Vec<Thing> {
let mut output: Vec<Thing> = Vec::new();
output.push(Thing::Str("Hello".to_string()));
output.push(Thing::Boolean(true));
return output
}
fn main() {
let result = run();
for i in result {
println!("{:?}", i)
}
}
when I run this code it works fine but I am getting output like this
Str("Hello")
Boolean(true)
How can I get the values like
"Hello"
true
so I can use this values for further processing like concat the string or something similar.
Thanks for help.