#[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 = "LetterBox"] #[doc = r""] #[doc = r"
JSON schema"] #[doc = r""] #[doc = r" ```json"] #[doc = "{"] #[doc = " \"title\": \"LetterBox\","] #[doc = " \"type\": \"object\","] #[doc = " \"properties\": {"] #[doc = " \"letter\": {"] #[doc = " \"type\": \"string\","] #[doc = " \"enum\": ["] #[doc = " \"a\","] #[doc = " \"b\","] #[doc = " \"cee\""] #[doc = " ],"] #[doc = " \"maxLength\": 2"] #[doc = " }"] #[doc = " }"] #[doc = "}"] #[doc = r" ```"] #[doc = r"
"] #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] pub struct LetterBox { #[serde(default, skip_serializing_if = "Option::is_none")] pub letter: Option, } impl From<&LetterBox> for LetterBox { fn from(value: &LetterBox) -> Self { value.clone() } } #[doc = "LetterBoxLetter"] #[doc = r""] #[doc = r"
JSON schema"] #[doc = r""] #[doc = r" ```json"] #[doc = "{"] #[doc = " \"type\": \"string\","] #[doc = " \"enum\": ["] #[doc = " \"a\","] #[doc = " \"b\","] #[doc = " \"cee\""] #[doc = " ],"] #[doc = " \"maxLength\": 2"] #[doc = "}"] #[doc = r" ```"] #[doc = r"
"] #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum LetterBoxLetter { #[serde(rename = "a")] A, #[serde(rename = "b")] B, } impl From<&LetterBoxLetter> for LetterBoxLetter { fn from(value: &LetterBoxLetter) -> Self { value.clone() } } impl ::std::fmt::Display for LetterBoxLetter { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { Self::A => write!(f, "a"), Self::B => write!(f, "b"), } } } impl std::str::FromStr for LetterBoxLetter { type Err = self::error::ConversionError; fn from_str(value: &str) -> Result { match value { "a" => Ok(Self::A), "b" => Ok(Self::B), _ => Err("invalid value".into()), } } } impl std::convert::TryFrom<&str> for LetterBoxLetter { type Error = self::error::ConversionError; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for LetterBoxLetter { type Error = self::error::ConversionError; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for LetterBoxLetter { type Error = self::error::ConversionError; fn try_from(value: String) -> Result { value.parse() } } fn main() {}