Guest User

Untitled

a guest
Jun 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. extern crate serde_json;
  2. #[macro_use]
  3. extern crate serde_derive;
  4. extern crate serde;
  5.  
  6. use std::collections::HashMap;
  7. use serde_json::Value;
  8.  
  9. const JASON: &str = r#"
  10. {
  11. "add0" : {
  12. "callcreates" : []
  13.  
  14. },
  15. "add1" : {
  16. "callcreates" : []
  17. }
  18. }"#;
  19.  
  20. #[derive(Debug, Deserialize)]
  21. pub struct OpCode {
  22. callcreates: Vec<u32>,
  23. }
  24.  
  25. fn main() {
  26. let op_codes: HashMap<String, OpCode> = serde_json::from_str(JASON).unwrap();
  27. println!("{:?}", op_codes);
  28. }
Add Comment
Please, Sign In to add comment