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)
| Column | Size | Description |
|---|---|---|
| Class | TypeDef index | Type that implements the interface |
| Interface | TypeDefOrRef coded index | Interface 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: u32Row identifier within the InterfaceImpl table.
Unique identifier for this interface implementation entry, used for internal table management and token generation.
token: TokenMetadata 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: usizeByte offset of this entry within the raw table data.
Used for efficient table navigation and binary metadata processing.
class: u32TypeDef 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: CodedIndexTypeDefOrRef 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
impl InterfaceImplRaw
pub fn apply(&self, types: &TypeRegistry) -> Result<()>
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 successfullyErr(_)- 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>
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 structureErr(_)- 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
impl Clone for InterfaceImplRaw
§fn clone(&self) -> InterfaceImplRaw
fn clone(&self) -> InterfaceImplRaw
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for InterfaceImplRaw
impl Debug for InterfaceImplRaw
§impl<'a> RowDefinition<'a> for InterfaceImplRaw
impl<'a> RowDefinition<'a> for InterfaceImplRaw
§fn row_size(sizes: &TableInfoRef) -> u32
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>
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 rowoffset- Current read position, updated after readingrid- Row identifier for this entrysizes- Table sizing information for variable-width fields
§Returns
Ok(InterfaceImplRaw)- Successfully parsed table rowErr(_)- Binary data reading or parsing error
Auto Trait Implementations§
impl Freeze for InterfaceImplRaw
impl RefUnwindSafe for InterfaceImplRaw
impl Send for InterfaceImplRaw
impl Sync for InterfaceImplRaw
impl Unpin for InterfaceImplRaw
impl UnwindSafe for InterfaceImplRaw
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