[][src]Struct rtdlib_sys::Tdlib

pub struct Tdlib { /* fields omitted */ }

Implementations

impl Tdlib[src]

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

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 rtdlib_sys::Tdlib;
Tdlib::set_log_verbosity_level(3);

pub fn set_log_max_file_size(size: i64)[src]

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 rtdlib_sys::Tdlib;
Tdlib::set_log_max_file_size(1024 * 1024);

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

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 rtdlib_sys::Tdlib;
Tdlib::set_log_file_path(Some("/var/log/tdlib/tdlib.log"));

pub fn new() -> Self[src]

Creates a new instance of TDLib.

Examples

use rtdlib_sys::Tdlib;
let tdlib = Tdlib::new();

pub fn send(&self, request: &str)[src]

Sends request to the TDLib client.

May be called from any thread.

Examples

use rtdlib_sys::Tdlib;
let tdlib = Tdlib::new();
let request = r#"{"@type": "getMe"}"#;
tdlib.send(request);

pub fn execute(&self, request: &str) -> Option<String>[src]

Synchronously executes TDLib request.

May be called from any thread. Only a few requests can be executed synchronously.

Examples

use rtdlib_sys::Tdlib;
let tdlib = Tdlib::new();
let request = r#"{"@type": "getTextEntities", "text": "@telegram /test_command https://telegram.org telegram.me"}"#;
tdlib.execute(request);

pub fn receive(&self, timeout: f64) -> Option<String>[src]

Receives incoming updates and request responses from the TDLib client.

May be called from any thread, but shouldn't be called simultaneously from two different threads.

Examples

use rtdlib_sys::Tdlib;
let tdlib = Tdlib::new();
tdlib.receive(5.0);

Trait Implementations

impl Debug for Tdlib[src]

impl Drop for Tdlib[src]

impl Send for Tdlib[src]

impl Sync for Tdlib[src]

Auto Trait Implementations

impl RefUnwindSafe for Tdlib

impl Unpin for Tdlib

impl UnwindSafe for Tdlib

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.