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
//! Owned `FieldMarshal` structures for the `FieldMarshal` metadata table.
//!
//! This module provides the [`crate::metadata::tables::fieldmarshal::owned::FieldMarshal`] struct which represents marshalling
//! specifications with resolved references and owned data. Field marshals define
//! how fields and parameters should be converted when crossing managed/unmanaged
//! boundaries during interop operations.
//!
//! # Purpose
//! The `FieldMarshal` table is critical for interop scenarios:
//! - **P/Invoke marshalling**: Converting parameters for native function calls
//! - **COM interop**: Field and parameter handling for COM objects
//! - **Custom marshalling**: User-defined conversion behavior
//! - **Array marshalling**: Element type and size specifications
//! - **String marshalling**: Character encoding and memory management
//!
//! # Marshalling Scenarios
//! - **Parameter marshalling**: Method parameter conversion for native calls
//! - **Field marshalling**: Struct field layout for interop types
//! - **Return value marshalling**: Converting return values from native code
//! - **Callback marshalling**: Delegate parameter conversion
//! - **Structure marshalling**: Complex type layout preservation
//!
//! # ECMA-335 Reference
//! See ECMA-335, Partition II, §22.17 for the `FieldMarshal` table specification.
use Arc;
use crate::;
/// Represents a field marshal specification with resolved references and owned data.
///
/// A field marshal defines how a specific field or parameter should be marshalled
/// when crossing managed/unmanaged boundaries. This includes type conversion rules,
/// memory management strategies, and platform-specific handling requirements.
///
/// # Marshalling Context
/// Field marshals are applied in various interop scenarios:
/// - **P/Invoke calls**: Converting managed parameters to native representations
/// - **COM interop**: Handling COM interface parameters and fields
/// - **Callback functions**: Converting delegate parameters for native callbacks
/// - **Structure layouts**: Ensuring proper field alignment in interop types
/// - **Array handling**: Managing array element marshalling and size information
///
/// # Parent Types
/// The marshal specification can apply to:
/// - **Fields**: Instance or static fields requiring specific marshalling
/// - **Parameters**: Method parameters for P/Invoke or COM calls
///
/// # ECMA-335 Reference
/// See ECMA-335, Partition II, §22.17 for the complete `FieldMarshal` table specification.