Preguntas con la etiqueta [serde]

Lista serde preguntas

use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] enum Animal { Cat(Option<String>), Dog(String), Bird, } fn main() { let json_animals = r#" [ {"Cat": "Meow"}, "Cat", {"Dog": "Bark"}, "Bird" ]"#; println!("{:?}", serde_json::from_str::<Vec<Animal>>(json_animals).unwrap());