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
//! Derive support for [`tonlib_core::tlb_types::tlb::TLB`].
//!
//! The macro is intentionally compatibility-first with the existing local `tlb-derive`
//! surface used in TON projects built on `tonlib-core`.
//!
//! Crates that use `#[derive(TLB)]` must declare `tonlib-core` in their own
//! `[dependencies]`, because the generated impls reference `tonlib-core`
//! directly. This proc-macro crate only needs `tonlib-core` in
//! `[dev-dependencies]` for its own test suite.
use TokenStream;
use parse_macro_input;
/// Derives [`tonlib_core::tlb_types::tlb::TLB`] for structs and enums.
///
/// Supported attributes:
/// - `#[tlb(tag = "$001")]`
/// - `#[tlb(tag = "#c0ffee")]`
/// - `#[tlb(bit_len = 5)]`
/// - `#[tlb(skip)]`
/// - `#[tlb(skip_read)]`
/// - `#[tlb(skip_write)]`
/// - `#[tlb(default)]`
/// - `#[tlb(default_with = "path::to::default")]`
/// - `#[tlb(read_with = "path::to::reader", write_with = "path::to::writer")]`
///
/// The deriving crate must depend on `tonlib-core`.