pub struct DcPool { /* private fields */ }Expand description
Pool of per-DC authenticated connections.
Implementations§
Source§impl DcPool
impl DcPool
pub fn new(home_dc_id: i32, dc_entries: &[DcEntry]) -> Self
Sourcepub fn has_connection(&self, dc_id: i32) -> bool
pub fn has_connection(&self, dc_id: i32) -> bool
Returns true if a connection for dc_id already exists in the pool.
Sourcepub fn insert(&mut self, dc_id: i32, conn: DcConnection)
pub fn insert(&mut self, dc_id: i32, conn: DcConnection)
Insert a pre-built connection into the pool.
Sourcepub async fn invoke_on_dc<R: RemoteCall>(
&mut self,
dc_id: i32,
_dc_entries: &[DcEntry],
req: &R,
) -> Result<Vec<u8>, InvocationError>
pub async fn invoke_on_dc<R: RemoteCall>( &mut self, dc_id: i32, _dc_entries: &[DcEntry], req: &R, ) -> Result<Vec<u8>, InvocationError>
Invoke a raw RPC call on the given DC.
Sourcepub fn update_addrs(&mut self, entries: &[DcEntry])
pub fn update_addrs(&mut self, entries: &[DcEntry])
Update the address table (called after initConnection).
Sourcepub fn collect_keys(&self, entries: &mut Vec<DcEntry>)
pub fn collect_keys(&self, entries: &mut Vec<DcEntry>)
Save the auth keys from pool connections back into the DC entry list.
Auto Trait Implementations§
impl Freeze for DcPool
impl RefUnwindSafe for DcPool
impl Send for DcPool
impl Sync for DcPool
impl Unpin for DcPool
impl UnsafeUnpin for DcPool
impl UnwindSafe for DcPool
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more