You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let data: Value = json::from_str(&s).unwrap();
let meshes = data.find("meshes").unwrap();
let mesh_array = meshes.as_array().unwrap();
let mesh = mesh_array[0].as_object().unwrap();
let vertices: Vec<f64> = (json::from_value (mesh.get("vertices").unwrap()) ).unwrap();
get the error:
src/main.rs:17:49: 17:78 error: mismatched types:
expected `serde::json::value::Value`,
found `&serde::json::value::Value`
(expected enum `serde::json::value::Value`,
found &-ptr) [E0308]
src/main.rs:17 let vertices: Vec<f64> = (json::from_value (mesh.get("vertices").unwrap()) ).unwrap();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unwrap().clone() works here, but it is very consuming right?
is there a pass-by-ref version json::from_value, how to deal with this?
The text was updated successfully, but these errors were encountered:
There isn't a pass-by-ref because I want to retain the option to move strings out of the maps without copies. Do you need to deserialize into a Value? If not you could instead deserialize into a
When I try to deserialize an array to vector:
get the error:
unwrap().clone() works here, but it is very consuming right?
is there a pass-by-ref version json::from_value, how to deal with this?
The text was updated successfully, but these errors were encountered: