How can I deserialize an enum when the case doesn't match?

前端 未结 1 1407
星月不相逢
星月不相逢 2021-01-20 10:39

I have a JSON structure that looks like this:

{ \"type\": \"suite\", \"event\": \"started\", \"test_count\": 1 }

I want to deserialize into

1条回答
  •  离开以前
    2021-01-20 11:10

    You just need to put #[serde(rename_all = "snake_case")] before the enum definition.

    0 讨论(0)
提交回复
热议问题