Crates.io | rtdlib |
lib.rs | rtdlib |
version | 1.8.1 |
source | src |
created_at | 2019-05-27 02:42:27.394986 |
updated_at | 2022-01-29 04:40:16.77224 |
description | TDLib for rust |
homepage | https://github.com/fewensa/rtdlib |
repository | https://github.com/fewensa/rtdlib |
max_upload_size | |
id | 137242 |
size | 3,934,829 |
rtdlib
is td for rust.
rtdlib
crate have td type (classes).
[dependencies]
rtdlib = "1.8.*"
The default, rtdlib
only have td
types, not have call tdjson dylib, if you want , you need add features
to your dependency.
[dependencies]
rtdlib = { version = "1.8.*", features = "sys" }
Please read: version
let json = r#"{"@type":"updateAuthorizationState","authorization_state":{"@type":"authorizationStateWaitTdlibParameters"}}"#;
let state: UpdateAuthorizationState = serde_json::from_str(&json[..]).expect("Json fail");
assert_eq!("updateAuthorizationState", state.td_name());
let rjson = state.to_json();
assert!(rjson.is_ok(), true);
assert_eq!(json, rjson.unwrap());
If you enable sys
features, you can use Tdlib
to call tdjson dylib.
use rtdlib::Tdlib;
let tdlib = Tdlib::new();
let request = r#"{"@type": "getMe"}"#;
tdlib.send(request);
More document you need check telegram api