Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug)]
- enum Status {
- Pending,
- Downloading,
- Downloaded,
- Outdated,
- }
- fn main() {
- let foo = Status::Pending;
- let ser = format!("Age of Empires||{:?}", foo);
- let raw_de = ser.split("||").map(|x| x.to_owned()).collect::<Vec<String>>();
- let name = &raw_de[0];
- let status = match &(&raw_de[1])[..] {
- "Pending" => Status::Pending,
- "Downloading" => Status::Downloading,
- "Downloaded" => Status::Downloaded,
- "Outdated" => Status::Outdated,
- _ => panic!()
- };
- println!("{}, {:?}", name, status);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement