Advertisement
Guest User

Untitled

a guest
May 25th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #[derive(Debug)]
  2. enum Status {
  3. Pending,
  4. Downloading,
  5. Downloaded,
  6. Outdated,
  7. }
  8.  
  9. fn main() {
  10. let foo = Status::Pending;
  11. let ser = format!("Age of Empires||{:?}", foo);
  12. let raw_de = ser.split("||").map(|x| x.to_owned()).collect::<Vec<String>>();
  13. let name = &raw_de[0];
  14. let status = match &(&raw_de[1])[..] {
  15. "Pending" => Status::Pending,
  16. "Downloading" => Status::Downloading,
  17. "Downloaded" => Status::Downloaded,
  18. "Outdated" => Status::Outdated,
  19. _ => panic!()
  20. };
  21. println!("{}, {:?}", name, status);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement