pub struct Worker<A, S> where
    A: AuthStateHandler + Send + Sync + 'static,
    S: TdLibClient + Send + Sync + Clone + 'static, 
{ /* private fields */ }
Expand description

The main object in all interactions. You have to start worker and bind each client with worker using auth_client.

Implementations

Returns state of the client.

Drops authorized client. After method call you cannot interact with TDLib by the client.

Method waits for client state changes. If an error occured during authorization flow, you receive AuthorizationState on which it happened. You have to setup channel by call Client::builder().with_auth_state_channel(…)

Method waits for client state changes. It differ from wait_auth_state_change by error type: you won’t receive (AuthorizationState)[crate::types::authorization_state::AuthorizationState] when error occured. Method may be useful if client already authorized on, for example, previous application startup.

Binds client with worker and runs authorization routines. Method returns error if worker is not running or client already bound

Determines that the worker is running.

Starts interaction with TDLib. It returns JoinHandle which allows you to handle worker state: if it yields - so worker is definitely stopped.

Stops the client. You may want to await JoinHandle retrieved with client.start().await after calling stop.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.