Skip to main content

Method

Struct Method 

Source
pub struct Method {
Show 17 fields pub address: *mut c_void, pub token: u32, pub name: String, pub class: Option<*const Class>, pub return_type: Type, pub flags: i32, pub is_static: bool, pub function: *mut c_void, pub rva: u64, pub va: u64, pub args: Vec<Arg>, pub is_generic: bool, pub is_inflated: bool, pub is_instance: bool, pub param_count: u8, pub declaring_type: *mut c_void, pub instance: Option<*mut c_void>,
}
Expand description

Hydrated IL2CPP method metadata plus optional bound instance state.

Fields§

§address: *mut c_void

Pointer to the internal IL2CPP method structure

§token: u32

Metadata token for this method

§name: String

Name of the method

§class: Option<*const Class>

Class defining this method

§return_type: Type

Return type of the method

§flags: i32

Flags associated with the method

§is_static: bool

Whether the method is static

§function: *mut c_void

Pointer to the potentially compiled native function

§rva: u64

Relative Virtual Address of the method (static offset from image base)

§va: u64

Virtual Address of the method at runtime (includes ASLR slide)

§args: Vec<Arg>

List of arguments for this method

§is_generic: bool

Whether the method is generic

§is_inflated: bool

Whether the method is an inflated generic method

§is_instance: bool

Whether the method is an instance method

§param_count: u8

Number of parameters this method accepts

§declaring_type: *mut c_void

Pointer to the declaring type

§instance: Option<*mut c_void>

Instance pointer for instance methods

Implementations§

Source§

impl Method

Implementation of Method operations

Source

pub unsafe fn call<T: Copy>(&self, params: &[*mut c_void]) -> Result<T, String>

Invokes the method with the provided parameter pointers.

For static methods, self.instance is ignored. For instance methods, the method must either have been returned from Object::method(...) or have its instance pointer set manually.

T must match the actual managed return shape:

  • use pointer-sized types for reference returns
  • use the concrete value type for value-type returns
  • use () for void

Managed exceptions are converted into Err(String).

Source

pub fn get_attribute(&self) -> &'static str

Gets the access modifier attribute string

Source

pub fn get_object(&self) -> *mut c_void

Gets the method object

§Returns
  • *mut c_void - The pointer to the MethodInfo object
Source

pub fn inflate(&self, classes: &[&Class]) -> Result<Method, String>

Inflates a generic method with the specified type arguments to create a concrete generic method.

§Arguments
  • classes - The type arguments
§Returns
  • Result<Method, String> - The inflated method

Trait Implementations§

Source§

impl Clone for Method

Source§

fn clone(&self) -> Method

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

impl Debug for Method

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Method

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Send for Method

Source§

impl Sync for Method

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.