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] to EventList[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

Fields§

§rid: u32

Row 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: Token

Metadata 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: usize

Byte 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: u32

Parent 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: u32

Event 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

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 reference
  • events - The Event table for resolving event references in the range
  • event_ptr - The EventPtr table for indirection resolution (if present)
  • map - The EventMap table 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
  • EventPtr indirection resolution fails

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 parsed TypeDef entries
  • events - The Event table containing all parsed Event entries
  • event_ptr - The EventPtr table for indirection resolution (if present)
  • map - The EventMap table 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

§

fn clone(&self) -> EventMapRaw

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for EventMapRaw

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl RowReadable for EventMapRaw

§

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 data
  • offset - Current position in the stream (updated after reading)
  • rid - Row identifier for this EventMap entry (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

§

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 data
  • offset - 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

§

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.