Skip to main content

PeerInfo

Enum PeerInfo 

Source
pub enum PeerInfo {
    User {
        id: i64,
        auth: Option<PeerAuth>,
        bot: Option<bool>,
        is_self: Option<bool>,
    },
    Chat {
        id: i64,
    },
    Channel {
        id: i64,
        auth: Option<PeerAuth>,
        kind: Option<ChannelKind>,
    },
}
Expand description

An exploded peer reference along with any known useful information about the peer.

Variants§

§

User

Fields

§id: i64

Bare user identifier.

Despite being i64, Telegram only uses strictly positive values.

§auth: Option<PeerAuth>

Non-ambient authority bound to both the user itself and the session.

§bot: Option<bool>

Whether this user represents a bot or not.

§is_self: Option<bool>

Whether this user represents the logged-in user authorized by this session or not.

§

Chat

Fields

§id: i64

Bare chat identifier.

Note that the HTTP Bot API negates this identifier to signal that it is a chat, but the true value used by Telegram’s API is always strictly-positive.

§

Channel

Fields

§id: i64

Bare channel identifier.

Note that the HTTP Bot API prefixes this identifier with -100 to signal that it is a channel, but the true value used by Telegram’s API is always strictly-positive.

§auth: Option<PeerAuth>

Non-ambient authority bound to both the user itself and the session.

§kind: Option<ChannelKind>

Channel kind, useful to determine what the possible permissions on it are.

Implementations§

Source§

impl PeerInfo

Source

pub fn id(&self) -> PeerId

Returns the PeerId represented by this info.

The returned PeerId::kind() will never be PeerKind::UserSelf.

Source

pub fn auth(&self) -> Option<PeerAuth>

Returns the PeerAuth stored in this info.

Trait Implementations§

Source§

impl Clone for PeerInfo

Source§

fn clone(&self) -> PeerInfo

Returns a duplicate 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 PeerInfo

Source§

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

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

impl<'a> From<&'a Channel> for PeerInfo

Source§

fn from(channel: &'a Channel) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a ChannelForbidden> for PeerInfo

Source§

fn from(channel: &'a ChannelForbidden) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Chat> for PeerInfo

Source§

fn from(chat: &'a Chat) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Chat> for PeerInfo

Source§

fn from(chat: &'a Chat) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a ChatEmpty> for PeerInfo

Source§

fn from(chat: &'a ChatEmpty) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a ChatForbidden> for PeerInfo

Source§

fn from(chat: &'a ChatForbidden) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a User> for PeerInfo

Source§

fn from(user: &'a User) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a User> for PeerInfo

Source§

fn from(user: &'a User) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a UserEmpty> for PeerInfo

Source§

fn from(user: &'a UserEmpty) -> Self

Converts to this type from the input type.
Source§

impl From<Channel> for PeerInfo

Source§

fn from(channel: Channel) -> Self

Converts to this type from the input type.
Source§

impl From<ChannelForbidden> for PeerInfo

Source§

fn from(channel: ChannelForbidden) -> Self

Converts to this type from the input type.
Source§

impl From<Chat> for PeerInfo

Source§

fn from(chat: Chat) -> Self

Converts to this type from the input type.
Source§

impl From<Chat> for PeerInfo

Source§

fn from(chat: Chat) -> Self

Converts to this type from the input type.
Source§

impl From<ChatEmpty> for PeerInfo

Source§

fn from(chat: ChatEmpty) -> Self

Converts to this type from the input type.
Source§

impl From<ChatForbidden> for PeerInfo

Source§

fn from(chat: ChatForbidden) -> Self

Converts to this type from the input type.
Source§

impl From<User> for PeerInfo

Source§

fn from(user: User) -> Self

Converts to this type from the input type.
Source§

impl From<User> for PeerInfo

Source§

fn from(user: User) -> Self

Converts to this type from the input type.
Source§

impl From<UserEmpty> for PeerInfo

Source§

fn from(user: UserEmpty) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for PeerInfo

Source§

fn eq(&self, other: &PeerInfo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for PeerInfo

Source§

impl StructuralPartialEq for PeerInfo

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

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>,

Source§

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>,

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more