artichoke_backend::def

Function box_unbox_free

Source
pub unsafe extern "C" fn box_unbox_free<T>(
    _mrb: *mut mrb_state,
    data: *mut c_void,
)
where T: 'static + BoxUnboxVmValue,
Expand description

A generic implementation of a Free function for mrb_values that store an owned copy of a Box smart pointer.

This function ultimately calls Box::from_raw on the data pointer and drops the resulting Box.

ยงSafety

The given data pointer must be non-null and allocated by Box.

This function assumes that the data pointer is to an Box<T> created by Box::into_raw. This function bounds T by BoxUnboxVmValue which boxes T for the mruby VM like this.

This function assumes it is called by the mruby VM as a free function for an MRB_TT_CDATA.