Enum tbot::types::parameters::ChatId[][src]

#[non_exhaustive]
#[must_use]
pub enum ChatId {
    Id(Id),
    Username(String),
}

Represents possible ways to specify the destination chat.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Id(Id)

The ID of a chat.

Username(String)

The @username of a chat.

Implementations

impl ChatId[src]

pub fn is_id(&self) -> bool[src]

Returns true if self is of variant Id.

pub fn expect_id(self) -> Id where
    Self: Debug
[src]

Unwraps the value, yielding the content of Id.

Panics

Panics if the value is not Id, with a panic message including the content of self.

pub fn id(self) -> Option<Id>[src]

Returns Some if self is of variant Id, and None otherwise.

pub fn is_username(&self) -> bool[src]

Returns true if self is of variant Username.

pub fn expect_username(self) -> String where
    Self: Debug
[src]

Unwraps the value, yielding the content of Username.

Panics

Panics if the value is not Username, with a panic message including the content of self.

pub fn username(self) -> Option<String>[src]

Returns Some if self is of variant Username, and None otherwise.

Trait Implementations

impl Clone for ChatId[src]

impl Debug for ChatId[src]

impl<'a> From<&'a String> for ChatId[src]

impl<'a> From<&'a str> for ChatId[src]

impl From<Id> for ChatId[src]

impl From<Id> for ChatId[src]

impl From<String> for ChatId[src]

impl From<i64> for ChatId[src]

impl Hash for ChatId[src]

impl PartialEq<ChatId> for ChatId[src]

impl Serialize for ChatId[src]

impl Eq for ChatId[src]

impl ImplicitChatId for ChatId[src]

impl StructuralEq for ChatId[src]

impl StructuralPartialEq for ChatId[src]

Auto Trait Implementations

impl RefUnwindSafe for ChatId

impl Send for ChatId

impl Sync for ChatId

impl Unpin for ChatId

impl UnwindSafe for ChatId

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.