use crate::types::InlineQueryResultVoiceKind;
use strum_macros::{AsRefStr, Display, EnumString, IntoStaticStr};
#[derive(Debug, Display, Clone, Copy, PartialEq, Eq, Hash, EnumString, AsRefStr, IntoStaticStr)]
pub enum InlineQueryResultVoiceKindType {
#[strum(serialize = "uncached")]
Uncached,
#[strum(serialize = "cached")]
Cached,
}
impl InlineQueryResultVoiceKindType {
#[must_use]
pub const fn all() -> [InlineQueryResultVoiceKindType; 2usize] {
[
InlineQueryResultVoiceKindType::Uncached,
InlineQueryResultVoiceKindType::Cached,
]
}
}
impl From<InlineQueryResultVoiceKindType> for Box<str> {
fn from(val: InlineQueryResultVoiceKindType) -> Self {
Into::<&'static str>::into(val).into()
}
}
impl From<InlineQueryResultVoiceKindType> for String {
fn from(val: InlineQueryResultVoiceKindType) -> Self {
val.as_ref().to_owned()
}
}
impl<'a> PartialEq<&'a str> for InlineQueryResultVoiceKindType {
fn eq(&self, other: &&'a str) -> bool {
self.as_ref() == *other
}
}
impl<'a> From<&'a InlineQueryResultVoiceKind> for InlineQueryResultVoiceKindType {
fn from(val: &'a InlineQueryResultVoiceKind) -> Self {
match val {
InlineQueryResultVoiceKind::Uncached(_) => InlineQueryResultVoiceKindType::Uncached,
InlineQueryResultVoiceKind::Cached(_) => InlineQueryResultVoiceKindType::Cached,
}
}
}
impl From<InlineQueryResultVoiceKind> for InlineQueryResultVoiceKindType {
fn from(val: InlineQueryResultVoiceKind) -> Self {
InlineQueryResultVoiceKindType::from(&val)
}
}