#[derive(Debug, PartialEq, Clone, serde::Deserialize, serde::Serialize, Default)] #[serde(default)] pub struct User { #[serde(rename = "as")] pub field_as: String, #[serde(rename = "favoriteNumber")] #[serde(default = "User::default_favorite_number")] pub favorite_number: i32, #[serde(default = "User::default_likes_pizza")] pub likes_pizza: bool, #[serde(default = "User::default_b")] pub b: Vec, #[serde(default = "User::default_union_b")] pub union_b: Option>, #[serde(rename = "A_Bool")] #[serde(default = "User::default_a_bool")] pub a_bool: Vec, #[serde(rename = "SomeInteger")] #[serde(default = "User::default_some_integer")] pub some_integer: Vec, pub map_of_f64: std::collections::HashMap, } impl User { #[inline(always)] pub fn default_favorite_number() -> i32 { 7 } #[inline(always)] pub fn default_likes_pizza() -> bool { false } #[inline(always)] pub fn default_b() -> Vec { "ΓΏ".to_string() } #[inline(always)] pub fn default_union_b() -> Option> { None } #[inline(always)] pub fn default_a_bool() -> Vec { vec![true, false] } #[inline(always)] pub fn default_some_integer() -> Vec { vec![12, -1] } }