Struct grammers_session::PackedChat
source · pub struct PackedChat {
pub ty: PackedType,
pub id: i64,
pub access_hash: Option<i64>,
}
Expand description
A packed chat
Fields§
§ty: PackedType
§id: i64
§access_hash: Option<i64>
Implementations§
source§impl PackedChat
impl PackedChat
sourcepub fn to_bytes(&self) -> [u8; 17]
pub fn to_bytes(&self) -> [u8; 17]
Serialize the PackedChat
into a fixed-size byte array.
sourcepub fn to_hex(&self) -> String
pub fn to_hex(&self) -> String
Serialize the PackedChat
to_bytes
and return it as a hexadecimal string.
sourcepub fn from_bytes(buf: &[u8]) -> Result<Self, Error>
pub fn from_bytes(buf: &[u8]) -> Result<Self, Error>
Deserialize a byte array into a PackedChat
.
The slice length must match that of to_bytes
output or an Err
will be returned.
A reference to a fixed-size array isn’t used as the input parameter type for convenience.
sourcepub fn from_hex(hex: &str) -> Result<Self, Error>
pub fn from_hex(hex: &str) -> Result<Self, Error>
Deserialize the hexadecimal string into a packed chat.
pub fn is_user(&self) -> bool
pub fn is_chat(&self) -> bool
pub fn is_channel(&self) -> bool
pub fn to_peer(&self) -> Peer
pub fn to_input_peer(&self) -> InputPeer
pub fn try_to_input_user(&self) -> Option<InputUser>
pub fn to_input_user_lossy(&self) -> InputUser
pub fn try_to_chat_id(&self) -> Option<i64>
pub fn try_to_input_channel(&self) -> Option<InputChannel>
Trait Implementations§
source§impl Clone for PackedChat
impl Clone for PackedChat
source§fn clone(&self) -> PackedChat
fn clone(&self) -> PackedChat
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PackedChat
impl Debug for PackedChat
source§impl Display for PackedChat
impl Display for PackedChat
source§impl Hash for PackedChat
impl Hash for PackedChat
source§impl Ord for PackedChat
impl Ord for PackedChat
source§fn cmp(&self, other: &PackedChat) -> Ordering
fn cmp(&self, other: &PackedChat) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for PackedChat
impl PartialEq for PackedChat
source§impl PartialOrd for PackedChat
impl PartialOrd for PackedChat
impl Copy for PackedChat
impl Eq for PackedChat
impl StructuralPartialEq for PackedChat
Auto Trait Implementations§
impl Freeze for PackedChat
impl RefUnwindSafe for PackedChat
impl Send for PackedChat
impl Sync for PackedChat
impl Unpin for PackedChat
impl UnwindSafe for PackedChat
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)