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: u32Row identifier within the MethodImpl table.
Unique identifier for this method implementation mapping entry, used for internal table management and cross-references.
token: TokenMetadata token identifying this MethodImpl entry.
The token enables efficient lookup and reference to this implementation mapping from other metadata structures and runtime systems.
offset: usizeByte offset of this entry within the raw table data.
Used for efficient table navigation and binary metadata processing.
class: CilTypeRcResolved 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: CilTypeReferenceResolved 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: CilTypeReferenceResolved 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
impl MethodImpl
pub fn apply(&self) -> Result<()>
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 successfullyErr(_)- If updating type system relationships fails (currently infallible)
§Errors
Returns an error if updating type system relationships fails (currently infallible).
Auto Trait Implementations§
impl Freeze for MethodImpl
impl RefUnwindSafe for MethodImpl
impl Send for MethodImpl
impl Sync for MethodImpl
impl Unpin for MethodImpl
impl UnwindSafe for MethodImpl
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> 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