1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! # layer: Telegram MTProto library
//!
//! `layer` is a modular Rust library for the Telegram MTProto protocol.
//! It consists of four focused sub-crates wired together here for convenience:
//!
//! | Sub-crate | Role |
//! |-------------------|---------------------------------------------------|
//! | `layer-tl-parser` | Parse `.tl` schema files into an AST |
//! | `layer-tl-gen` | Generate Rust source from the AST (build-time) |
//! | `layer-tl-types` | Auto-generated types, functions & enums |
//! | `layer-mtproto` | Session state, message framing, transport traits |
//!
//! ## Quick start: raw API
//!
//! ```rust,no_run
//! use layer::tl::{functions, Serializable, RemoteCall};
//! use layer::mtproto::{Session, transport::AbridgedTransport};
//!
//! // Build a raw TL request
//! let req = functions::help::GetConfig {};
//! let bytes = req.to_bytes();
//!
//! // Pack it into an MTProto message
//! let mut session = Session::new();
//! let msg = session.pack(&req);
//! let wire = msg.to_plaintext_bytes();
//!
//! // Send over your transport…
//! ```
//!
//! ## Updating the API layer
//!
//! Replace `layer-tl-types/tl/api.tl` with the new schema and run `cargo build`.
//! Everything else regenerates automatically.
/// Re-export of [`layer_tl_types`]: generated constructors, functions and enums.
pub use layer_tl_types as tl;
/// Re-export of [`layer_mtproto`]: session, encrypted session, transport, and authentication.
pub use layer_mtproto as mtproto;
/// Re-export of [`layer_crypto`]: AES-IGE, SHA, RSA, factorize, AuthKey.
pub use layer_crypto as crypto;
/// Re-export of [`layer_tl_parser`] (requires `feature = "parser"`).
pub use layer_tl_parser as parser;
/// Re-export of [`layer_tl_gen`] (requires `feature = "codegen"`).
pub use layer_tl_gen as codegen;
// Convenience re-exports
pub use ;
pub use AuthKey;
pub use ;
pub use ;