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
//! Owned `FieldLayout` structures for the `FieldLayout` metadata table.
//!
//! This module provides the [`crate::metadata::tables::fieldlayout::owned::FieldLayout`] struct which represents field layout
//! definitions with resolved references and owned data. Field layouts specify
//! the explicit byte offset of fields within types that use explicit layout.
//!
//! # Purpose
//! The `FieldLayout` table is used when precise control over field positioning is needed:
//! - **Interop scenarios**: Matching native struct layouts for P/Invoke
//! - **Performance optimization**: Controlling memory layout for cache efficiency
//! - **Platform compatibility**: Ensuring consistent layouts across architectures
//! - **Legacy compatibility**: Matching existing binary data formats
//!
//! # Layout Types
//! - **Sequential**: Default .NET layout (no `FieldLayout` entries needed)
//! - **Explicit**: Programmer-specified field offsets (requires `FieldLayout` entries)
//! - **Auto**: Runtime-optimized layout (no `FieldLayout` entries)
//!
//! # ECMA-335 Reference
//! See ECMA-335, Partition II, §22.16 for the `FieldLayout` table specification.
use crate::;
/// Represents a field layout definition with resolved references and owned data.
///
/// A field layout specifies the explicit byte offset of a field within its containing
/// type. This is used when types have explicit layout attributes that require precise
/// control over field positioning in memory.
///
/// # Field Layout Context
/// Field layouts are only present for types that use explicit layout:
/// - **StructLayout(LayoutKind.Explicit)**: C# structs with explicit field positioning
/// - **Interop types**: Types designed for P/Invoke or COM interop
/// - **Performance-critical types**: Types optimized for specific memory access patterns
///
/// # ECMA-335 Reference
/// See ECMA-335, Partition II, §22.16 for the complete `FieldLayout` table specification.
///
/// [`Arc`]: std::sync::Arc