Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. use serde::{Deserialize,Serialize};
  2.  
  3. #[derive(Deserialize,Serialize)]
  4. // #[serde(tag = "type")]
  5. #[serde(tag = "type", content = "content")]
  6. pub enum Colors {
  7. Red = 0,
  8. Blue,
  9. }
  10.  
  11. fn main() {
  12. println!("{}", serde_json::to_string(&Colors::Red).unwrap());
  13. println!("{}", serde_json::to_string(&Colors::Blue).unwrap());
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement