#![allow(deprecated)]
use std::fmt;
use std::str;
#[derive(
Debug,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
conjure_object::serde::Deserialize,
conjure_object::serde::Serialize,
)]
#[serde(crate = "conjure_object::serde")]
pub enum FloatingLegendPresetPosition {
#[serde(rename = "TOP_LEFT")]
TopLeft,
#[serde(rename = "TOP_RIGHT")]
TopRight,
#[serde(rename = "BOTTOM_LEFT")]
BottomLeft,
#[serde(rename = "BOTTOM_RIGHT")]
BottomRight,
#[serde(untagged)]
Unknown(Unknown),
}
impl FloatingLegendPresetPosition {
#[inline]
pub fn as_str(&self) -> &str {
match self {
FloatingLegendPresetPosition::TopLeft => "TOP_LEFT",
FloatingLegendPresetPosition::TopRight => "TOP_RIGHT",
FloatingLegendPresetPosition::BottomLeft => "BOTTOM_LEFT",
FloatingLegendPresetPosition::BottomRight => "BOTTOM_RIGHT",
FloatingLegendPresetPosition::Unknown(v) => &*v,
}
}
}
impl fmt::Display for FloatingLegendPresetPosition {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(self.as_str(), fmt)
}
}
impl conjure_object::Plain for FloatingLegendPresetPosition {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
conjure_object::Plain::fmt(self.as_str(), fmt)
}
}
impl str::FromStr for FloatingLegendPresetPosition {
type Err = conjure_object::plain::ParseEnumError;
#[inline]
fn from_str(
v: &str,
) -> Result<FloatingLegendPresetPosition, conjure_object::plain::ParseEnumError> {
match v {
"TOP_LEFT" => Ok(FloatingLegendPresetPosition::TopLeft),
"TOP_RIGHT" => Ok(FloatingLegendPresetPosition::TopRight),
"BOTTOM_LEFT" => Ok(FloatingLegendPresetPosition::BottomLeft),
"BOTTOM_RIGHT" => Ok(FloatingLegendPresetPosition::BottomRight),
v => v.parse().map(|v| FloatingLegendPresetPosition::Unknown(Unknown(v))),
}
}
}
impl conjure_object::FromPlain for FloatingLegendPresetPosition {
type Err = conjure_object::plain::ParseEnumError;
#[inline]
fn from_plain(
v: &str,
) -> Result<FloatingLegendPresetPosition, conjure_object::plain::ParseEnumError> {
v.parse()
}
}
#[derive(
Debug,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
conjure_object::serde::Deserialize,
conjure_object::serde::Serialize,
)]
#[serde(crate = "conjure_object::serde", transparent)]
pub struct Unknown(conjure_object::private::Variant);
impl std::ops::Deref for Unknown {
type Target = str;
#[inline]
fn deref(&self) -> &str {
&self.0
}
}
impl fmt::Display for Unknown {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.0, fmt)
}
}