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
65
// Do not break MSRV 1.85.1
use TokenStream;
use ;
/// Implements `Length`, `Encode`, `Decode` and `TestInstance` with one default value for structs and enums.
/// And creates parts structs for structs with `new` and `raw` methods and adds `into_parts` and `from_parts` methods to the original struct.
///
/// # Enums
///
/// ## Container attributes
///
/// - `#[repr(u8)]`, `#[repr(u16)]`, or `#[repr(u32)]`: Use the `From<u8>`, `From<u16>`, or `From<u32>`/`Into<u8>`, `Into<u16>`, or `Into<u32>` representation for decoding.
/// - `#[rusmpp(decode = skip|owned|borrowed|all)]`: Control which `Decode` implementations to generate. Default is `all`.
/// - `#[rusmpp(test = skip)]`: Skip impl `TestInstance` for the enum.
/// - `#[rusmpp(from_into = skip)]`: Skip implementing `From<repr>` and `From<Enum>` for the enum.
///
/// # Structs
///
/// ## Container attributes
///
/// - `#[rusmpp(repr = "u8")]`: Use the `From<u8>`/`Into<u8>` representation for decoding.
/// - `#[rusmpp(decode = skip|owned|borrowed|all)]`: Control which `Decode` implementations to generate. Default is `all`.
/// - `#[rusmpp(test = skip)]`: Skip impl `TestInstance` for the struct.
///
/// ## Field attributes
///
/// - `#[rusmpp(skip_decode)]`: Skip decoding the field (requires a corresponding `new` constructor that does not take the skipped field as an argument).
/// - `#[rusmpp(length = "unchecked")]`: Decode without length checks.
/// - `#[rusmpp(length = "checked")]`: Decode using `length_checked_decode`.
/// - `#[rusmpp(length = ident)]`: Use the value of another field (`ident`) as the length for decoding.
/// - `#[rusmpp(key = ident, length = "unchecked")]`: Decode using a key and unchecked length.
/// - `#[rusmpp(key = ident, length = ident)]`: Decode using a key and the value of another field (`ident`) as the length.
/// - `#[rusmpp(count = ident)]`: Decode a vector of values, where `ident` is the number of elements to decode.
///
/// # Examples
///
/// See `tests/expand`.
/// Creates a `TlvValue`-like and implements `Into<TlvValue>` and `Into<Tlv>`.