artichoke_backend::def

Type Alias Method

Source
pub type Method = unsafe extern "C" fn(mrb: *mut mrb_state, slf: mrb_value) -> mrb_value;
Expand description

Typedef for a method exposed in the mruby interpreter.

This function signature is used for all types of mruby methods, including instance methods, class methods, singleton methods, and global methods.

slf is the method receiver, e.g. s in the following invocation of String#start_with?.

s = 'artichoke crate'
s.start_with?('artichoke')

To extract method arguments, use mrb_get_args! and the supplied interpreter.