1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
use libc; use std::mem; #[repr(C)] pub struct RubyArray { len: libc::size_t, data: *const libc::c_void, } impl RubyArray { #[allow(dead_code)] pub fn from_vec<T>(vec: Vec<T>) -> RubyArray { let array = RubyArray { data: vec.as_ptr() as *const libc::c_void, len: vec.len() as libc::size_t }; mem::forget(vec); array } }