Recently while working on something in C++ I realized that I haven’t the slightest idea how I’d manage to do the same thing in safe Rust.
Basically given a big binary blob on disk, I’m memory mapping the file and have a simple api for getting pointers to const structs so that applications can use the data. It’s entirely read-only, there is no copying data, and it’s pretty fast.
My understanding is that this falls into the boogeyman zone of unsafe Rust and Transmute. But how could a non-copy operation like this take place using only safe Rust? Mem mapping immutable data is a pretty awesome thing in my eyes, but maybe my eyes just haven’t bled enough to notice the terror?