Hello fellows!
Could you review this simple usage of std::mem::transmute
(lifetime extension): playground (commented)?
From the docs:
transmute
is incredibly unsafe. There are a vast number of ways to cause undefined behavior with this function.transmute
should be the absolute last resort.
There are a few things that
transmute
is really useful for. [...] Extending a lifetime, or shortening an invariant lifetime. This is advanced, very unsafe Rust!
^ Yep this is what we are doing!
Thank you all!