Trait Define
mruby::def
pub trait Define where Self: ClassLike, { fn define(&self, interp: &Mrb) -> Result<*mut RClass, MrbError>; }
Define trait allows a type to install classes, modules, and methods into an mruby interpreter.
Define
fn define(&self, interp: &Mrb) -> Result<*mut RClass, MrbError>
Define the class or module and all of its methods into the interpreter.
Returns the RClass * of the newly defined item.
RClass *
This function takes a mutable borrow on the Mrb interpreter. Ensure that there are no outstanding borrows on the interpreter or else Rust will panic.
Mrb
impl Define for mruby::class::Spec
impl Define for mruby::module::Spec