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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
//! Implementation of `RowReadable` for `ParamRaw` metadata table entries.
//!
//! This module provides binary deserialization support for the `Param` table (ID 0x08),
//! enabling reading of method parameter metadata from .NET PE files. The Param table
//! contains information about method parameters including their names, attributes,
//! sequence numbers, and marshalling details, forming a crucial part of method signatures.
//!
//! ## Table Structure (ECMA-335 §II.22.33)
//!
//! | Field | Type | Description |
//! |-------|------|-------------|
//! | `Flags` | `u16` | Parameter attributes bitmask |
//! | `Sequence` | `u16` | Parameter sequence number (0 = return type, 1+ = parameters) |
//! | `Name` | String heap index | Parameter name identifier |
//!
//! ## Parameter Attributes
//!
//! The `Flags` field contains parameter attributes with common values:
//! - `0x0001` - `In` (input parameter)
//! - `0x0002` - `Out` (output parameter)
//! - `0x0010` - `Optional` (optional parameter with default value)
//! - `0x1000` - `HasDefault` (parameter has default value)
//! - `0x2000` - `HasFieldMarshal` (parameter has marshalling information)
//!
//! ## Usage Context
//!
//! Param entries are used for:
//! - **Method Signatures**: Defining parameter information for method definitions
//! - **Parameter Attributes**: Specifying parameter direction, optionality, and marshalling
//! - **Default Values**: Linking to default parameter values in Constant table
//! - **Reflection Operations**: Runtime parameter discovery and invocation
//! - **Interop Support**: P/Invoke parameter marshalling and type conversion
//!
//! ## Sequence Numbers
//!
//! Parameter sequence numbers follow a specific convention:
//! - **Sequence 0**: Return type parameter (when return type has attributes)
//! - **Sequence 1+**: Method parameters in declaration order
//! - **Contiguous**: Sequence numbers must be contiguous for proper resolution
//! - **Method Scope**: Sequence numbers are relative to the containing method
//!
//! ## Parameter Resolution
//!
//! Parameters are associated with methods through several mechanisms:
//! - **Direct Range**: Method parameter lists define contiguous Param table ranges
//! - **ParamPtr Indirection**: Optional indirection through ParamPtr table
//! - **Sequence Ordering**: Parameters ordered by sequence number within method scope
//! - **Attribute Resolution**: Parameter attributes resolved from various tables
//!
//! ## Thread Safety
//!
//! The `RowReadable` implementation is stateless and safe for concurrent use across
//! multiple threads during metadata loading operations.
//!
//! ## Related Modules
//!
//! - [`crate::metadata::tables::param::writer`] - Binary serialization support
//! - [`crate::metadata::tables::param`] - High-level Param interface
//! - [`crate::metadata::tables::param::raw`] - Raw structure definition
//! - [`crate::metadata::tables::methoddef`] - Method parameter associations
//! - [`crate::metadata::tables::paramptr`] - Parameter indirection support
use crate::;