3 ms·
> you're not going to be able to do this in Rust unless all the code is unsafe. Why wouldn't std::mem::transmute (plus a little bit of hand-managed lifetime em
by zbentley 5y ago
> you're not going to be able to do this in Rust unless all the code is unsafe.
Why wouldn't std::mem::transmute (plus a little bit of hand-managed lifetime emulation) work here? It is unsafe, but doesn't require the unsafe modifier to be present on code beyond where the transmute happens. Unless by "all the code is unsafe" you mean related code is conceptually at risk of unsafety due to bugs caused by erroneous reinterpret-casts, then I think transmute should work here.