When you say that, you mean… it’s unimplementable in safe Rust due to a silly reason called safety.
If you really want this, why not use mem::uninitialized? This seems like exactly the sort of thing unsafe was created for: allowing “flexibility” for these sorts of, umm, exotic use cases while still allowing the safe subset of the language to retain some pretty strong safety guarantees, like all memory is initialized before use.
Though this paper claims these particular algorithms will always produce the same results regardless of what the values of the uninitialized memory were to begin with, that isn’t always the case. Here’s a paper on exploiting uninitialized kernel memory to affect privilege escalation:
Exposing uninitialized memory has multiple potential security ramifications, the exact extent of which will vary heavily depending on your application of Rust and application of uninitialized memory. Experience suggests, however, that if you give attackers wiggle room they will exploit it, so it’s best not to give it to them in the first place.