Enum grammers_client::types::chat::Chat

source ·
pub enum Chat {
    User(User),
    Group(Group),
    Channel(Channel),
}
Expand description

A chat.

Chats represent places where you can share messages with others.

  • Private conversations with other people are treated as the chat of the user itself.
  • Conversations in a group, whether it’s private or public, are simply known as groups.
  • Conversations where only administrators broadcast messages are known as channels.

Variants§

§

User(User)

A User.

§

Group(Group)

A Group chat.

§

Channel(Channel)

A broadcast Channel.

Implementations§

source§

impl Chat

source

pub fn id(&self) -> i64

Return the unique identifier for this chat.

Every account will see the same identifier for the same chat.

This identifier will never change. However, small group chats may be migrated to megagroups. If this happens, both the old small group chat and the new megagroup exist as separate chats with different identifiers, but they are linked with a property.

source

pub fn name(&self) -> &str

Return the name of this chat.

For private conversations (users), this is their first name. For groups and channels, this is their title.

The name may be empty if the chat is inaccessible or if the account was deleted.

source

pub fn pack(&self) -> PackedChat

Pack this chat into a smaller representation that can be loaded later.

source

pub fn username(&self) -> Option<&str>

Return the public @username of this chat, if any.

The returned username does not contain the “@” prefix.

Outside of the application, people may link to this user with one of Telegram’s URLs, such as https://t.me/username.

source

pub fn photo_downloadable(&self, big: bool) -> Option<Downloadable>

Trait Implementations§

source§

impl Clone for Chat

source§

fn clone(&self) -> Chat

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Chat

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&Chat> for PackedChat

source§

fn from(chat: &Chat) -> Self

Converts to this type from the input type.
source§

impl From<Chat> for PackedChat

source§

fn from(chat: Chat) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Chat

§

impl RefUnwindSafe for Chat

§

impl Send for Chat

§

impl Sync for Chat

§

impl Unpin for Chat

§

impl UnwindSafe for Chat

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.