telers 1.0.0-beta.2

An asynchronous framework for Telegram Bot API written in Rust
Documentation
use crate::types::ChatFullInfo;
use strum_macros::{AsRefStr, Display, EnumString, IntoStaticStr};
/// This object contains full information about a chat.
/// Currently, it can be one of
/// - [`crate::types::ChatFullInfoChannel`]
/// - [`crate::types::ChatFullInfoGroup`]
/// - [`crate::types::ChatFullInfoPrivate`]
/// - [`crate::types::ChatFullInfoSupergroup`]
/// # Documentation
/// <https://core.telegram.org/bots/api#chatfullinfo>
#[derive(Debug, Display, Clone, Copy, PartialEq, Eq, Hash, EnumString, AsRefStr, IntoStaticStr)]
pub enum ChatFullInfoType {
    #[strum(serialize = "private")]
    Private,
    #[strum(serialize = "group")]
    Group,
    #[strum(serialize = "supergroup")]
    Supergroup,
    #[strum(serialize = "channel")]
    Channel,
}
impl ChatFullInfoType {
    #[must_use]
    pub const fn all() -> [ChatFullInfoType; 4usize] {
        [
            ChatFullInfoType::Private,
            ChatFullInfoType::Group,
            ChatFullInfoType::Supergroup,
            ChatFullInfoType::Channel,
        ]
    }
}
impl From<ChatFullInfoType> for Box<str> {
    fn from(val: ChatFullInfoType) -> Self {
        Into::<&'static str>::into(val).into()
    }
}
impl From<ChatFullInfoType> for String {
    fn from(val: ChatFullInfoType) -> Self {
        val.as_ref().to_owned()
    }
}
impl<'a> PartialEq<&'a str> for ChatFullInfoType {
    fn eq(&self, other: &&'a str) -> bool {
        self.as_ref() == *other
    }
}
impl<'a> From<&'a ChatFullInfo> for ChatFullInfoType {
    fn from(val: &'a ChatFullInfo) -> Self {
        match val {
            ChatFullInfo::Private(_) => ChatFullInfoType::Private,
            ChatFullInfo::Group(_) => ChatFullInfoType::Group,
            ChatFullInfo::Supergroup(_) => ChatFullInfoType::Supergroup,
            ChatFullInfo::Channel(_) => ChatFullInfoType::Channel,
        }
    }
}
impl From<ChatFullInfo> for ChatFullInfoType {
    fn from(val: ChatFullInfo) -> Self {
        ChatFullInfoType::from(&val)
    }
}