Skip to main content

get_method_by_index

Function get_method_by_index 

Source
pub fn get_method_by_index(
    type_index: i32,
    method_name: &str,
) -> Result<Function>
Expand description

Look up a reflected method of a type by type index and method name, as get_method does by type key.

Reflected methods, registered in any language (such as with ObjectDef::def), live in the type’s method table rather than the global function table. The constructor is reachable under the reserved name __ffi_init__. For instance methods, the first argument is the object itself.

§Arguments

  • type_index - The type index of the type that owns the method.
  • method_name - The name of the method.

§Returns

The reflected method.

§Errors

Returns a TypeError if type_index is not registered or the type has no method method_name.