MemorySession

Struct MemorySession 

Source
pub struct MemorySession(/* private fields */);
Expand description

In-memory session interface.

Does not actually offer direct ways to persist the state anywhere, so it should only be used in very few select cases.

Logging in has a very high cost in terms of flood wait errors, so the state really should be persisted by other means.

Trait Implementations§

Source§

impl Default for MemorySession

Source§

fn default() -> MemorySession

Returns the “default value” for a type. Read more
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

Source§

impl Session for MemorySession

Source§

fn home_dc_id(&self) -> i32

Datacenter that is “home” to the user authorized by this session. Read more
Source§

fn set_home_dc_id(&self, dc_id: i32)

Changes the Session::home_dc_id after finding out the actual datacenter to which main queries should be executed against.
Source§

fn dc_option(&self, dc_id: i32) -> Option<DcOption>

Query a single datacenter option. Read more
Source§

fn set_dc_option(&self, dc_option: &DcOption)

Update the previously-known Session::dc_option with new values. Read more
Source§

fn peer(&self, peer: PeerId) -> Option<PeerInfo>

Query a peer by its identity. Read more
Source§

fn cache_peer(&self, peer: &PeerInfo)

Cache a peer’s basic information for Session::peer to be able to query them later. Read more
Source§

fn updates_state(&self) -> UpdatesState

Loads the entire updates state.
Source§

fn set_update_state(&self, update: UpdateState)

Update the state for one or all updates.

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.