#![allow(clippy::redundant_closure_call)] #![allow(clippy::needless_lifetimes)] #![allow(clippy::match_single_binding)] #![allow(clippy::clone_on_copy)] #[doc = r" Error types."] pub mod error { #[doc = r" Error from a TryFrom or FromStr implementation."] pub struct ConversionError(::std::borrow::Cow<'static, str>); impl ::std::error::Error for ConversionError {} impl ::std::fmt::Display for ConversionError { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> { ::std::fmt::Display::fmt(&self.0, f) } } impl ::std::fmt::Debug for ConversionError { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> { ::std::fmt::Debug::fmt(&self.0, f) } } impl From<&'static str> for ConversionError { fn from(value: &'static str) -> Self { Self(value.into()) } } impl From for ConversionError { fn from(value: String) -> Self { Self(value.into()) } } } #[doc = "Fruit"] #[doc = r""] #[doc = r"
JSON schema"] #[doc = r""] #[doc = r" ```json"] #[doc = "{"] #[doc = " \"type\": \"object\""] #[doc = "}"] #[doc = r" ```"] #[doc = r"
"] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] pub struct Fruit(pub ::serde_json::Map); impl ::std::ops::Deref for Fruit { type Target = ::serde_json::Map; fn deref(&self) -> &::serde_json::Map { &self.0 } } impl From for ::serde_json::Map { fn from(value: Fruit) -> Self { value.0 } } impl From<&Fruit> for Fruit { fn from(value: &Fruit) -> Self { value.clone() } } impl From<::serde_json::Map> for Fruit { fn from(value: ::serde_json::Map) -> Self { Self(value) } } #[doc = "FruitOrVeg"] #[doc = r""] #[doc = r"
JSON schema"] #[doc = r""] #[doc = r" ```json"] #[doc = "{"] #[doc = " \"oneOf\": ["] #[doc = " {"] #[doc = " \"title\": \"veg\","] #[doc = " \"anyOf\": ["] #[doc = " {"] #[doc = " \"$ref\": \"#/defs/veggie\""] #[doc = " }"] #[doc = " ]"] #[doc = " },"] #[doc = " {"] #[doc = " \"title\": \"fruit\","] #[doc = " \"anyOf\": ["] #[doc = " {"] #[doc = " \"$ref\": \"#/defs/fruit\""] #[doc = " }"] #[doc = " ]"] #[doc = " }"] #[doc = " ]"] #[doc = "}"] #[doc = r" ```"] #[doc = r"
"] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] #[serde(untagged)] pub enum FruitOrVeg { Veg(Veggie), Fruit(Fruit), } impl From<&FruitOrVeg> for FruitOrVeg { fn from(value: &FruitOrVeg) -> Self { value.clone() } } impl From for FruitOrVeg { fn from(value: Veggie) -> Self { Self::Veg(value) } } impl From for FruitOrVeg { fn from(value: Fruit) -> Self { Self::Fruit(value) } } #[doc = "Veggie"] #[doc = r""] #[doc = r"
JSON schema"] #[doc = r""] #[doc = r" ```json"] #[doc = "{"] #[doc = " \"type\": \"object\","] #[doc = " \"required\": ["] #[doc = " \"veggieLike\","] #[doc = " \"veggieName\""] #[doc = " ],"] #[doc = " \"properties\": {"] #[doc = " \"veggieLike\": {"] #[doc = " \"description\": \"Do I like this vegetable?\","] #[doc = " \"type\": \"boolean\""] #[doc = " },"] #[doc = " \"veggieName\": {"] #[doc = " \"description\": \"The name of the vegetable.\","] #[doc = " \"type\": \"string\""] #[doc = " }"] #[doc = " }"] #[doc = "}"] #[doc = r" ```"] #[doc = r"
"] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] pub struct Veggie { #[doc = "Do I like this vegetable?"] #[serde(rename = "veggieLike")] pub veggie_like: bool, #[doc = "The name of the vegetable."] #[serde(rename = "veggieName")] pub veggie_name: String, } impl From<&Veggie> for Veggie { fn from(value: &Veggie) -> Self { value.clone() } } #[doc = "A representation of a person, company, organization, or place"] #[doc = r""] #[doc = r"
JSON schema"] #[doc = r""] #[doc = r" ```json"] #[doc = "{"] #[doc = " \"$id\": \"https://example.com/arrays.schema.json\","] #[doc = " \"title\": \"veggies\","] #[doc = " \"description\": \"A representation of a person, company, organization, or place\","] #[doc = " \"type\": \"object\","] #[doc = " \"properties\": {"] #[doc = " \"fruits\": {"] #[doc = " \"type\": \"array\","] #[doc = " \"items\": {"] #[doc = " \"type\": \"string\""] #[doc = " }"] #[doc = " },"] #[doc = " \"vegetables\": {"] #[doc = " \"type\": \"array\","] #[doc = " \"items\": {"] #[doc = " \"$ref\": \"#/$defs/veggie\""] #[doc = " }"] #[doc = " }"] #[doc = " }"] #[doc = "}"] #[doc = r" ```"] #[doc = r"
"] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] pub struct Veggies { #[serde(default, skip_serializing_if = "Vec::is_empty")] pub fruits: Vec, #[serde(default, skip_serializing_if = "Vec::is_empty")] pub vegetables: Vec, } impl From<&Veggies> for Veggies { fn from(value: &Veggies) -> Self { value.clone() } }