I'm looking for a more elegant way to unwrap multiple option. and here is the my codes in question:
let acc_id = json_val.get("product_id").unwrap().as_i64().unwrap() as i32;
let user_agent = json_val.get("user_agent").unwrap().to_string();
To provide more context:
- both variables are required within a function and should fail if either fails to unwrap
- json_val is of type
JsonValuewhich is a type from theserde_jsonlib, pretty much like a hashmap data structure in this case