Struct EventMapRaw
pub struct EventMapRaw {
pub rid: u32,
pub token: Token,
pub offset: usize,
pub parent: u32,
pub event_list: u32,
}Expand description
Raw EventMap table row with unresolved indexes and table references
Represents the binary format of an EventMap metadata table entry (table ID 0x12) as stored
in the metadata tables stream. All type and event references are stored as table indexes
that must be resolved using the appropriate tables and registries.
EventMap entries establish ownership relationships between types and their events by
defining contiguous ranges in the Event table. This enables efficient enumeration
of all events declared by a particular type.
§Range Resolution
EventMap entries define event ranges implicitly:
- Events from
EventList[i] toEventList[i+1]-1 belong to Parent[i] - The final entry’s range extends to the end of the Event table
- Empty ranges are valid and indicate types with no events
§Reference
- ECMA-335 II.22.12 -
EventMaptable specification
Fields§
§rid: u32Row identifier within the EventMap metadata table
The 1-based index of this EventMap row. Used for metadata token generation
and cross-referencing with other metadata structures.
token: TokenMetadata token for this EventMap row
Combines the table identifier (0x12 for EventMap) with the row ID to create
a unique token. Format: 0x12000000 | rid
offset: usizeByte offset of this row within the metadata tables stream
Physical location of the raw EventMap data within the metadata binary format.
Used for debugging and low-level metadata analysis.
parent: u32Parent type table index (unresolved)
Index into the TypeDef table identifying the type that owns the events
in this range. Must be resolved using the type registry to obtain the
actual type reference.
event_list: u32Event list starting index (unresolved)
Index into the Event table pointing to the first event owned by the parent
type. The range extends to the next EventMap entry’s event_list value (or
end of Event table for the final entry).
Implementations§
§impl EventMapRaw
impl EventMapRaw
pub fn to_owned(
&self,
types: &TypeRegistry,
events: &EventMap,
event_ptr: &EventPtrMap,
map: &MetadataTable<'_, EventMapRaw>,
) -> Result<EventMapEntryRc>
pub fn to_owned( &self, types: &TypeRegistry, events: &EventMap, event_ptr: &EventPtrMap, map: &MetadataTable<'_, EventMapRaw>, ) -> Result<EventMapEntryRc>
Convert to owned EventMapEntry with resolved references and owned data
This method converts the raw EventMap entry into a fully resolved EventMapEntry
structure with owned data and resolved cross-references. The resulting structure
provides immediate access to the parent type and owned events without requiring
additional table lookups.
§Arguments
types- The type registry for resolving the parent type referenceevents- The Event table for resolving event references in the rangeevent_ptr- TheEventPtrtable for indirection resolution (if present)map- TheEventMaptable for determining event range boundaries
§Returns
Returns EventMapEntryRc (Arc-wrapped EventMapEntry) on success, providing
shared ownership of the resolved EventMap data.
§Errors
- The parent type lookup fails in the type registry
- Event range resolution fails due to invalid boundaries
- Event lookup fails for any event in the resolved range
EventPtrindirection resolution fails
pub fn apply(
&self,
types: &TypeRegistry,
events: &EventMap,
event_ptr: &EventPtrMap,
map: &MetadataTable<'_, EventMapRaw>,
) -> Result<()>
pub fn apply( &self, types: &TypeRegistry, events: &EventMap, event_ptr: &EventPtrMap, map: &MetadataTable<'_, EventMapRaw>, ) -> Result<()>
Apply this EventMap entry during metadata loading
Processes the raw EventMap entry and establishes the ownership relationship
between the parent type and its events. This method resolves the event range,
looks up all events in that range, and adds them to the parent type’s event
collection.
§Arguments
types- The type registry containing all parsedTypeDefentriesevents- The Event table containing all parsed Event entriesevent_ptr- TheEventPtrtable for indirection resolution (if present)map- TheEventMaptable for determining event range boundaries
§Returns
Returns Ok(()) on successful event assignment, or an error if:
- Event list resolution fails due to invalid range boundaries
- Event list validation fails (inconsistent with table state)
- Parent type lookup fails in the type registry
- Event assignment to parent type fails
§Errors
Returns crate::Error if the event list is invalid, parent type lookup
fails, or event assignment encounters metadata inconsistencies.
Trait Implementations§
§impl Clone for EventMapRaw
impl Clone for EventMapRaw
§fn clone(&self) -> EventMapRaw
fn clone(&self) -> EventMapRaw
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for EventMapRaw
impl Debug for EventMapRaw
§impl RowReadable for EventMapRaw
impl RowReadable for EventMapRaw
§fn row_read(
data: &[u8],
offset: &mut usize,
rid: u32,
sizes: &TableInfoRef,
) -> Result<Self>
fn row_read( data: &[u8], offset: &mut usize, rid: u32, sizes: &TableInfoRef, ) -> Result<Self>
Read an EventMap row from the metadata tables stream
Parses one EventMap table row from the binary metadata stream, handling
variable-size indexes based on table size information. Advances the offset
to point to the next row after successful parsing.
§Arguments
data- The metadata tables stream binary dataoffset- Current position in the stream (updated after reading)rid- Row identifier for thisEventMapentry (1-based)sizes- Table size information for determining index sizes
§Returns
Returns a parsed EventMapRaw instance with all fields populated
from the binary data.
§Errors
- The data stream is truncated or corrupted
- Index values exceed expected ranges
- Binary parsing encounters invalid data
§impl RowWritable for EventMapRaw
impl RowWritable for EventMapRaw
§fn row_write(
&self,
data: &mut [u8],
offset: &mut usize,
_rid: u32,
sizes: &TableInfoRef,
) -> Result<()>
fn row_write( &self, data: &mut [u8], offset: &mut usize, _rid: u32, sizes: &TableInfoRef, ) -> Result<()>
Serialize an EventMap table row to binary format
Writes the row data according to ECMA-335 §II.22.12 specification:
parent: TypeDef table index (type that owns the events)event_list: Event table index (first event owned by the parent type)
§Arguments
data- Target buffer for writing binary dataoffset- Current write position (updated after write)rid- Row identifier (unused in this implementation)sizes- Table sizing information for index widths
§Returns
Ok(()) on successful write, error on buffer overflow or encoding failure
§impl TableRow for EventMapRaw
impl TableRow for EventMapRaw
§fn row_size(sizes: &TableInfoRef) -> u32
fn row_size(sizes: &TableInfoRef) -> u32
Calculate the byte size of an EventMap table row
Computes the total size based on variable-size table indexes. The size depends on whether the metadata uses 2-byte or 4-byte indexes.
§Row Layout (ECMA-335 §II.22.12)
parent: 2 or 4 bytes (TypeDef table index)event_list: 2 or 4 bytes (Event table index)
§Arguments
sizes- Table sizing information for index widths
§Returns
Total byte size of one EventMap table row
Auto Trait Implementations§
impl Freeze for EventMapRaw
impl RefUnwindSafe for EventMapRaw
impl Send for EventMapRaw
impl Sync for EventMapRaw
impl Unpin for EventMapRaw
impl UnwindSafe for EventMapRaw
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more