Skip to content

Commit 2d99cf7

Browse files
committed
fantasy
1 parent 5986ac3 commit 2d99cf7

File tree

1,115 files changed

+79627
-129499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,115 files changed

+79627
-129499
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ Cargo.lock
1919

2020

2121
_tmp
22-
_tdapihtml
22+
_src

Cargo.toml

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rtdlib"
3-
version = "0.3.0"
3+
version = "100.100.100"
44
authors = ["fewensa <[email protected]>"]
55
description = "TDLib for rust"
66
homepage = "https://github.com/fewensa/rtdlib"
@@ -11,28 +11,15 @@ categories = ["api-bindings"]
1111
include = [
1212
"Cargo.toml",
1313
"**/*.rs",
14-
"**/*.tpl.txt",
15-
"**/*.tpl.toml",
1614
"README.md",
1715
"LICENSE"
1816
]
1917
readme = "README.md"
2018
edition = "2018"
2119

22-
#build = "build/build.rs"
23-
2420
[dependencies]
2521
libc = "0.2"
2622

2723
serde = "1"
2824
serde_derive = "1"
2925
serde_json = "1"
30-
typetag = "0.1"
31-
32-
strum = "0.15"
33-
strum_macros = "0.15"
34-
35-
text-reader = "0.2"
36-
rstring-builder = "0.1"
37-
38-
[build-dependencies]

README.md

+41-19
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,63 @@ rtdlib
44
[![Build Status](https://api.travis-ci.org/fewensa/rtdlib.svg)](https://travis-ci.org/fewensa/rtdlib/)
55

66

7-
`rtdlib` is [TDLib](https://github.com/tdlib/td) for rust.
7+
`rtdlib` is [td](https://github.com/tdlib/td) for rust.
88

9-
`rtdlib` crate have [TDLib](https://github.com/tdlib/td) type (classes). and `tdjson` [binding](./src/tdjson.rs). not have client api. if use `rtdlib` you need include `libtdjson.so` to you build path.
9+
`rtdlib` crate have [td](https://github.com/tdlib/td) type (classes). and `tdjson` [binding](../fantasy/template/rtdlib/src/tdjson.rs). if use `rtdlib` you need include `libtdjson.so` to you build path.
1010

1111

12+
# Note
1213

13-
# Build
14+
This crate code is generate by [fantasy](https://github.com/fewensa/fantasy).
1415

15-
`rtdlib` include a prebuilt td types, you can check [types](./src/types). The version of `>0.3.0` not provide build code before run this crate, last support version is [0.2.1](https://github.com/fewensa/rtdlib/releases/tag/0.2.1), if want generate types from [telegram official document](https://core.telegram.org/tdlib/docs/td__api_8h.html) you can check [generate](./generate) project.
1616

17-
When build from official document, rtdlib will generate a td [schema](./schema/schema.toml) file, but this file not include in cargo package, if you need use this file, you need check [schema.toml](./schema/schema.toml).
18-
19-
**BUILD TYPE.RS IS SLOWLY.**
17+
# Usage
2018

21-
**Notice**
19+
## latest
2220

23-
`rtdlib` build td type, use telegram official document, https://core.telegram.org/tdlib/docs/td__api_8h.html .
21+
```toml
22+
[dependencies]
23+
rtdlib = "100.100"
24+
```
2425

25-
So there is a possibility of compilation failure.
26+
## 1.3.*
2627

27-
It depends on whether the document has changed.
28+
```toml
29+
[dependencies]
30+
rtdlib = "1.3"
31+
```
2832

29-
When rtdlib is stable, the use of code generation is not recommended.
30-
31-
# Usage
33+
## 1.4.*
3234

3335
```toml
3436
[dependencies]
35-
rtdlib = "0.3"
37+
rtdlib = "1.4"
3638
```
3739

40+
## version
41+
42+
Since the rtdlib version follows [td](https://github.com/tdlib/td), a version number less than 100 is reserved for td release.
43+
44+
Version mapping
45+
46+
| rtdlib | td |
47+
|-----------|---------|
48+
| 100.100.* | master |
49+
| 1.3.* | 1.3.* |
50+
| 1.4.* | 1.4.* |
3851

39-
## type
52+
53+
# Example
54+
55+
## types
4056

4157
```rust
42-
let json = r#"{"@type":"updateAuthorizationState","@struct":"UpdateAuthorizationState","authorization_state":{"@type":"authorizationStateWaitTdlibParameters","@struct":"AuthorizationStateWaitTdlibParameters"}}"#;
58+
let json = r#"{"@type":"updateAuthorizationState","authorization_state":{"@type":"authorizationStateWaitTdlibParameters"}}"#;
4359
let state: UpdateAuthorizationState = serde_json::from_str(&json[..]).expect("Json fail");
4460
assert_eq!("updateAuthorizationState", state.td_name());
61+
let rjson = state.to_json();
62+
assert!(rjson.is_ok(), true);
63+
assert_eq!(json, rjson.unwrap());
4564
```
4665

4766
## tdjson
@@ -53,9 +72,12 @@ let request = r#"{"@type": "getMe"}"#;
5372
tdlib.send(request);
5473
```
5574

56-
and more document you need check [telegram api](https://core.telegram.org/api)
5775

58-
**How include libtdjson.so**
76+
# td
77+
78+
More document you need check [telegram api](https://core.telegram.org/api)
79+
80+
## How include libtdjson.so
5981

6082
The first you need read [td](https://github.com/tdlib/td#building) know how to build td.
6183

generate/Cargo.toml

-29
This file was deleted.

generate/README.md

-2
This file was deleted.

0 commit comments

Comments
 (0)