SessionData

Struct SessionData 

Source
pub struct SessionData {
    pub home_dc: i32,
    pub dc_options: HashMap<i32, DcOption>,
    pub peer_infos: HashMap<PeerId, PeerInfo>,
    pub updates_state: UpdatesState,
}
Expand description

In-memory representation of the entire Session state.

This type can be used for conversions From any Session, and be SessionData::import_to any other Session.

Fields§

§home_dc: i32

The identifier of the datacenter option determined to be the primary one for the logged-in user, or the identifier of an arbitrary datacenter otherwise.

§dc_options: HashMap<i32, DcOption>

List of all known datacenter options, along with their Authorization Key if an encrypted connection has been made to them previously. Indexed by their identifier.

§peer_infos: HashMap<PeerId, PeerInfo>

List of all peer informations cached in the session. Indexed by their identifier.

§updates_state: UpdatesState

Entirety of the update state for the logged-in user.

Implementations§

Source§

impl SessionData

Source

pub fn import_to<S: Session>(&self, session: &S)

Imports all information from this session data to a type implementing Session.

Trait Implementations§

Source§

impl Default for SessionData

Source§

fn default() -> Self

Constructs a default instance of the session data, with an arbitrary Self::home_dc and the list of statically-known Self::dc_options.

Source§

impl<S: Session> From<S> for SessionData

Source§

fn from(session: S) -> Self

Imports the basic information from any type implementing Session into SessionData.

Notably, only the standard DC options and the cached self-peer will be included.

Source§

impl From<SessionData> for MemorySession

Source§

fn from(session_data: SessionData) -> Self

Constructs a memory session from the entirety of the session data, unlike the blanket From implementation which cannot import all values

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