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
//! # Module Table Module
//!
//! This module provides comprehensive access to the **Module** metadata table (ID 0x00),
//! which contains information about the current module including its name, GUID (Mvid), and
//! generation. The Module table is fundamental to .NET metadata as it provides the identity
//! information for the current assembly module.
//!
//! ## Overview
//!
//! The Module table serves as the foundational identity table for .NET assemblies:
//! - **Unique Entry**: Always contains exactly one row per PE file
//! - **Module Identity**: Provides name and GUID for module identification
//! - **Version Management**: Includes generation and ENC (Edit and Continue) support
//! - **Foundation Table**: One of the first tables loaded with no dependencies
//!
//! The table establishes the basic identity that other metadata tables reference and build upon.
//!
//! ## Components
//!
//! The module implements a dual-representation pattern for optimal performance:
//!
//! - [`ModuleRaw`] - Raw table data with unresolved indexes for initial parsing
//! - [`Module`] - Processed data with resolved strings and GUIDs
//! - [`ModuleLoader`] - Handles conversion between raw and processed representations
//! - [`ModuleMap`] - Thread-safe storage mapping tokens to processed entries
//! - [`ModuleList`] - Thread-safe collection (though only one entry exists)
//!
//! ## Table Structure
//!
//! | Field | Type | Description |
//! |-------|------|-------------|
//! | `Generation` | `u16` | Reserved field, always zero |
//! | `Name` | `u32` | Index into string heap containing module name |
//! | `Mvid` | `u32` | Index into GUID heap containing module version identifier |
//! | `EncId` | `u32` | Index into GUID heap for Edit and Continue (reserved) |
//! | `EncBaseId` | `u32` | Index into GUID heap for Edit and Continue base (reserved) |
//!
//! The `Mvid` (Module Version Identifier) is a GUID that uniquely distinguishes between
//! different versions of the same module, enabling proper version management and resolution.
//!
//! ## Module Identity
//!
//! The Module table provides several levels of identity:
//!
//! 1. **Name Identity**: Human-readable module name from string heap
//! 2. **Version Identity**: GUID-based unique identifier (Mvid)
//! 3. **Generation**: Reserved for future versioning schemes
//! 4. **ENC Support**: Reserved GUIDs for Edit and Continue scenarios
//!
//! ## ECMA-335 Specification
//!
//! This implementation follows the ECMA-335 specification:
//! - **§II.22.30** - Module table structure and semantics
//! - **§II.23.2.6** - Module metadata token format
//! - **§II.24.2.1** - String and GUID heap references
//!
//! For detailed specifications, see [ECMA-335 6th Edition](https://www.ecma-international.org/wp-content/uploads/ECMA-335_6th_edition_june_2012.pdf).
use crateToken;
use SkipMap;
use Arc;
pub use *;
pub use *;
pub use *;
pub use *;
/// Thread-safe map holding the mapping of [`crate::metadata::token::Token`] to parsed [`Module`] entries.
///
/// This concurrent skip list provides efficient O(log n) access to module entries
/// by their metadata token. Since the Module table contains only one entry, this
/// map will typically contain a single element.
pub type ModuleMap = ;
/// Thread-safe vector holding a list of [`Module`] entries.
///
/// Uses a lock-free vector implementation for efficient concurrent access.
/// Since the Module table contains only one entry, this list will contain
/// exactly one element representing the current module.
pub type ModuleList = ;
/// Reference-counted pointer to a [`Module`] entry.
///
/// Enables efficient sharing of module data across multiple contexts
/// while maintaining memory safety through automatic reference counting.
pub type ModuleRc = ;