我想反序列化以下 JSON:
[
{
"name": "one",
"path": "/path/to/one"
},
{
"name": "two",
"path": "/path/to/two"
},
{
"name": "three",
"path": "/path/to/three"
}
]
进入一个Vec<Worskpace>
. Workspace
定义如下:
#[derive(Serialize, Deserialize)]
struct Workspace {
name: String,
path: String,
}
有没有办法做到这一点而不必做类似的事情:
#[derive(Serialize, Deserialize)]
struct Workspacesss {
values: Vec<Workspace>,
}