3 ms·
Maybe Rust needs another type of reference that's exclusive write only? Right now there's RO (&T) and exclusive RW (&mut T) but WO is missing. Having a WO refe
by Zagitta 2y ago
Maybe Rust needs another type of reference that's exclusive write only?
Right now there's RO (&T) and exclusive RW (&mut T) but WO is missing.
Having a WO reference would allow these read_buf APIs to express they only write and never read so the uninitialized memory is safe to pass directly.
- gpm 2y agoIn some sense that's exactly what a `&mut MaybeUninit<T>` is?
- mmastrac 2y agoProbably more once https://doc.rust-lang.org/beta/std/mem/union.MaybeUninit.html#method.copy_from_slice https://doc.rust-lang.org/beta/std/mem/union.MaybeUninit.htm... is no longer nightly-only.
- 1oooqooq 2y agoeveryone just tell you to use mpsr in this case