~tim/rust-ruby-wrap-data

99c560069bcb857cc391209eeee1e88f2b496a12 — Tim Morgan 2 years ago 4bc50a1
No need for public here
1 files changed, 1 insertions(+), 1 deletions(-)

M src/wrap.rs
M src/wrap.rs => src/wrap.rs +1 -1
@@ 29,7 29,7 @@ pub fn wrap<T>(klass: Value, data: Box<T>) -> Value {
    unsafe { rb_data_object_wrap(klass, datap, None, Some(free::<T>)) }
}

pub extern "C" fn free<T>(data: *mut c_void) {
extern "C" fn free<T>(data: *mut c_void) {
    // memory is freed when the box goes out of the scope
    let datap = data as *mut T;
    unsafe { Box::from_raw(datap) };