Client

Struct Client 

Source
pub struct Client { /* private fields */ }

Implementations§

Source§

impl Client

Source

pub fn set_log_verbosity_level<'a>(level: i32) -> Result<(), &'a str>

Sets the verbosity level of the internal logging of TDLib.

By default the TDLib uses a log verbosity level of 5.

§Parameters

level New value of logging verbosity level. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug, value greater than 5 and up to 1024 can be used to enable even more logging.

§Examples
use telegram_client::client::Client;
Client::set_log_verbosity_level(3);
Source

pub fn set_log_max_file_size(size: i64)

Sets maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated.

Unused if log is not written to a file. Defaults to 10 MB.

§Parameters

size Maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated. Should be positive.

§Examples
use telegram_client::client::Client;
Client::set_log_max_file_size(1024 * 1024);
Source

pub fn set_log_file_path(path: Option<&str>) -> bool

Sets the path to the file where the internal TDLib log will be written.

By default TDLib writes logs to stderr or an OS specific log. Use this method to write the log to a file instead.

§Parameters

path Maybe path to a file where the internal TDLib log will be written. Use None to switch back to the default logging behaviour.

§Examples
use telegram_client::client::Client;
Client::set_log_file_path(Some("/var/log/tdlib/tdlib.log"));
Source

pub fn new(api: Api) -> Self

Creates a new Client with api

§Examples
use telegram_client::client::Client;
use telegram_client::api::Api;
let client = Client::new(Api::default());
Source

pub fn start(&self) -> JoinHandle<()>

Start a Client.

§Examples
use telegram_client::client::Client;
let client = Client::default();
client.start();
Source

pub fn daemon<S: AsRef<str>>(self, _name: S) -> Result<()>

Start a daemon Client.

§Examples
use telegram_client::client::Client;
let client = Client::default();
client.daemon("tgclient");
Source

pub fn listener(&mut self) -> &mut Listener

Source

pub fn warn_unregister_listener(&mut self, value: bool)

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Client

Source§

fn default() -> Self

Creates a default Client

§Examples
use telegram_client::client::Client;
use telegram_client::api::Api;
let client = Client::new(Api::default());

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.