layer-tl-types
Auto-generated Rust types for all Telegram API Layer 224 constructors, functions, and enums.
2,329 TL definitions generated at build time. Includes binary TL serialization and deserialization via Serializable and Deserializable traits.
Installation
[]
= "0.4.7"
# With MTProto low-level types (required by layer-mtproto):
= { = "0.4.7", = ["tl-mtproto"] }
Generated Structure
// TL constructors become structs
// Abstract TL types become enums
// TL functions become structs implementing RemoteCall
Feature Flags
| Feature | Default | Description |
|---|---|---|
tl-api |
yes | Telegram API schema (api.tl) |
tl-mtproto |
no | MTProto internal schema (mtproto.tl) |
impl-debug |
yes | #[derive(Debug)] on all types |
impl-from-type |
yes | From<types::T> for enums::E |
impl-from-enum |
yes | TryFrom<enums::E> for types::T |
deserializable-functions |
no | Deserializable on function types |
name-for-id |
no | name_for_id(u32) -> Option<&'static str> |
impl-serde |
no | serde::Serialize / Deserialize |
Updating the TL Schema
layer-tl-gen regenerates all types at compile time via build.rs. No manual code changes needed.
Stack position
layer-client
└ layer-mtproto
└ layer-tl-types <-- here
└ (build) layer-tl-gen
└ (build) layer-tl-parser
License
MIT or Apache-2.0, at your option. See LICENSE-MIT and LICENSE-APACHE.
Ankit Chaubey - github.com/ankit-chaubey