Struct MethodImpl

pub struct MethodImpl {
    pub rid: u32,
    pub token: Token,
    pub offset: usize,
    pub class: CilTypeRc,
    pub method_body: CilTypeReference,
    pub method_declaration: CilTypeReference,
}
Expand description

Owned MethodImpl table entry with resolved references and implementation mappings.

This structure represents a method implementation mapping with all coded indexes resolved to their target structures and type references established. It provides complete implementation mapping information for interface implementation, method overriding, and virtual dispatch support in object-oriented programming.

§Implementation Mapping Types

MethodImpl entries support various implementation scenarios:

  • Interface implementation: Maps interface method declarations to concrete class implementations
  • Virtual method override: Specifies derived class methods that override base class methods
  • Explicit interface implementation: Handles explicit implementation of interface members
  • Abstract method implementation: Connects abstract declarations to concrete implementations

Fields§

§rid: u32

Row identifier within the MethodImpl table.

Unique identifier for this method implementation mapping entry, used for internal table management and cross-references.

§token: Token

Metadata token identifying this MethodImpl entry.

The token enables efficient lookup and reference to this implementation mapping from other metadata structures and runtime systems.

§offset: usize

Byte offset of this entry within the raw table data.

Used for efficient table navigation and binary metadata processing.

§class: CilTypeRc

Resolved reference to the class type containing the implementation mapping.

Specifies the type that provides the concrete implementation for the method declaration. This class contains the method body that implements the interface contract or overrides the virtual method.

§method_body: CilTypeReference

Resolved reference to the concrete method implementation.

Specifies the actual method that provides the implementation behavior. This method belongs to the class and contains the IL code or native implementation that fulfills the method contract.

§method_declaration: CilTypeReference

Resolved reference to the method declaration being implemented.

Specifies the interface method, abstract method, or virtual method declaration that is being implemented by the method body. This establishes the contract that the implementation must fulfill.

Implementations§

§

impl MethodImpl

pub fn apply(&self) -> Result<()>

Applies this method implementation mapping to update type system relationships.

This method establishes bidirectional relationships between method declarations and their implementations, updating both the implementing class and the declared method with cross-reference information. This enables efficient method resolution during virtual dispatch and interface member lookup operations.

§Implementation Updates

The method performs the following type system updates:

  • Class overwrites: Adds the method body to the class’s overwrite collection
  • Interface implementations: Adds the implementation to the declaration’s interface implementations
  • Bidirectional linking: Establishes cross-references for efficient lookup
§Method Resolution Support

These relationships enable sophisticated method resolution:

  • Virtual dispatch: Runtime can locate correct implementation for virtual calls
  • Interface casting: Interface method calls can be resolved to concrete implementations
  • Reflection support: Runtime reflection can discover implementation relationships
  • Debugging information: Development tools can trace method implementation chains
§Returns
  • Ok(()) - If the implementation mapping was applied successfully
  • Err(_) - If updating type system relationships fails (currently infallible)
§Errors

Returns an error if updating type system relationships fails (currently infallible).

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> 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, 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.