Struct InterfaceImplRaw

pub struct InterfaceImplRaw {
    pub rid: u32,
    pub token: Token,
    pub offset: usize,
    pub class: u32,
    pub interface: CodedIndex,
}
Expand description

Raw InterfaceImpl table entry with unresolved indexes and type references.

This structure represents an interface implementation entry as stored directly in the metadata stream. All references are unresolved table indexes that require processing during metadata loading to establish type system relationships.

§Table Structure (ECMA-335 §22.23)

ColumnSizeDescription
ClassTypeDef indexType that implements the interface
InterfaceTypeDefOrRef coded indexInterface being implemented

§Coded Index Resolution

The interface field uses the TypeDefOrRef coded index encoding:

  • Tag 0: TypeDef table (interfaces in current assembly)
  • Tag 1: TypeRef table (interfaces from other assemblies)
  • Tag 2: TypeSpec table (generic interface instantiations)

§Compiler Quirks

The .NET compiler incorrectly places interface inheritance relationships in the InterfaceImpl table instead of using proper base type relationships. This requires special handling during processing to distinguish between true interface implementation and interface-to-interface inheritance.

Fields§

§rid: u32

Row identifier within the InterfaceImpl table.

Unique identifier for this interface implementation entry, used for internal table management and token generation.

§token: Token

Metadata token for this InterfaceImpl entry (TableId 0x09).

Computed as 0x09000000 | rid to create the full token value for referencing this interface implementation from other metadata structures.

§offset: usize

Byte offset of this entry within the raw table data.

Used for efficient table navigation and binary metadata processing.

§class: u32

TypeDef table index for the implementing type.

References the type (class or interface) that implements or extends the target interface. Requires token construction (class | 0x02000000) and TypeDef lookup during processing.

§interface: CodedIndex

TypeDefOrRef coded index for the implemented interface.

Points to the interface being implemented or extended. Uses coded index encoding to reference TypeDef, TypeRef, or TypeSpec tables for different interface sources. Requires coded index resolution during processing to obtain the actual interface type.

Implementations§

§

impl InterfaceImplRaw

pub fn apply(&self, types: &TypeRegistry) -> Result<()>

Applies interface implementation directly to the type system.

This method resolves type references and immediately establishes the interface implementation relationship in the type system. It’s an alternative to the two-step process of conversion to owned structure followed by application.

§Arguments
  • types - Type registry containing all resolved type definitions
§Returns
  • Ok(()) - Interface implementation applied successfully
  • Err(_) - Type reference resolution failed
§Errors
  • Invalid class token or type not found in registry
  • Invalid interface coded index or type resolution failure

pub fn to_owned(&self, types: &TypeRegistry) -> Result<InterfaceImplRc>

Converts raw InterfaceImpl entry to owned structure with resolved type references.

This method processes the raw table entry by resolving all type references, creating an crate::metadata::tables::interfaceimpl::owned::InterfaceImpl instance with owned data suitable for runtime use and further processing.

§Arguments
  • types - Type registry containing all resolved type definitions
§Returns
  • Ok(InterfaceImplRc) - Successfully converted owned InterfaceImpl structure
  • Err(_) - Type reference resolution failed
§Errors
  • Invalid class token or type not found in registry
  • Invalid interface coded index or type resolution failure

Trait Implementations§

§

impl Clone for InterfaceImplRaw

§

fn clone(&self) -> InterfaceImplRaw

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 InterfaceImplRaw

§

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

Formats the value using the given formatter. Read more
§

impl<'a> RowDefinition<'a> for InterfaceImplRaw

§

fn row_size(sizes: &TableInfoRef) -> u32

Calculates the byte size of an InterfaceImpl table row based on table sizing information.

The row size depends on the size of table indexes and coded indexes, which vary based on the total number of entries in referenced tables.

§Row Layout
  • class: Variable size TypeDef table index (2 or 4 bytes)
  • interface: Variable size TypeDefOrRef coded index
§

fn read_row( data: &'a [u8], offset: &mut usize, rid: u32, sizes: &TableInfoRef, ) -> Result<Self>

Reads a single InterfaceImpl table row from binary metadata stream.

Parses the binary representation of an InterfaceImpl entry, reading fields in the order specified by ECMA-335 and handling variable-size indexes based on table sizing information.

§Arguments
  • data - Binary data containing the table row
  • offset - Current read position, updated after reading
  • rid - Row identifier for this entry
  • sizes - Table sizing information for variable-width fields
§Returns
  • Ok(InterfaceImplRaw) - Successfully parsed table row
  • Err(_) - Binary data reading or parsing error

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.