Closed Wodann closed 1 year ago
The remaining occurrences of raw pointers in the mun_abi
are either dynamic arrays or strings. Those cannot currently be converted to safer Rust types:
CString
or CStr
: https://github.com/eqrion/cbindgen/issues/782cbindgen also cannot support wide pointers like &dyn Trait or &[T], as their layout and ABI is not guaranteed. In the case of slices you can at least decompose them into a pointer and length, and reconstruct them with slice::from_raw_parts.
cbindgen supports conversion of references - with a lifetime - into pointers. Currently, we are using raw pointers in our
mun_abi
, but by converting them to references, we can make our Rust code safer.cargo test
)mun_abi
, replace as many instances of*const
and*mut
to&'a
and&'a mut
as possiblecloses #422
. If this is your first PR, welcome :tada: :smile: