Update boxed_vec to deal with boxed values

This commit is contained in:
Mark McCaskey
2020-10-02 16:33:03 -07:00
parent 34e6139570
commit e6c61c74ff
3 changed files with 6 additions and 5 deletions

View File

@@ -131,12 +131,14 @@ macro_rules! wasm_declare_boxed_vec {
// TODO: do this properly
impl [<wasm_ $name _vec_t>] {
pub unsafe fn into_slice(&self) -> Option<&[*mut [<wasm_ $name _t>]]>{
pub unsafe fn into_slice(&self) -> Option<&[Box<[<wasm_ $name _t>]>]>{
if self.data.is_null() {
return None;
}
Some(::std::slice::from_raw_parts(self.data, self.size))
let slice: &[*mut [<wasm_ $name _t>]] = ::std::slice::from_raw_parts(self.data, self.size);
let slice: &[Box<[<wasm_ $name _t>]>] = ::std::mem::transmute(slice);
Some(slice)
}
}