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
//! Derive marco for [messagepack_core::encode::Encode] and [messagepack_core::decode::Decode]
use TokenStream;
use ;
/// Derive the `Encode` trait for a struct.
///
/// # Supported types
/// - **Named-field structs** — encoded as a MessagePack map by default
/// - **Tuple structs** — encoded as a MessagePack array
/// - **Unit structs** — encoded as MessagePack `nil`
///
/// # Container attributes
/// - `#[msgpack(map)]` — encode as a MessagePack map (default for named-field structs)
/// - `#[msgpack(array)]` — encode as a MessagePack array
///
/// # Field attributes
/// - `#[msgpack(key = N)]` — required for all fields in `array` mode
/// - `#[msgpack(bytes)]` — encode the field as MessagePack binary
/// - `#[msgpack(encode_with = "path::to::fn")]` — custom encode function
/// Derive the `DecodeBorrowed` trait for a struct.
///
/// Named-field structs accept both map and array MessagePack formats on
/// decode regardless of the `map`/`array` attribute.
///
/// # Supported types
/// - **Named-field structs** — decoded from a MessagePack map or array
/// - **Tuple structs** — decoded from a MessagePack array
/// - **Unit structs** — decoded from MessagePack `nil`
///
/// # Container attributes
/// - `#[msgpack(map)]` — default for named-field structs
/// - `#[msgpack(array)]` — encode mode; requires `key` on every field
///
/// # Field attributes
/// - `#[msgpack(key = N)]` — array index (required in `array` mode)
/// - `#[msgpack(bytes)]` — decode the field from MessagePack binary
/// - `#[msgpack(decode_with = "path::to::fn")]` — custom decode function