Comment

Comment by p4lindromica

`mem::transmute` is roughly equivalent to a `reinterpret_cast` in C++. It treats the bits of a u8 as an i8.

In the Rust definition of safety (mutable xor shared, no data races, memory safety, etc), treating the bits of a u8 as an i8 is safe and can be done with an `as` cast.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton