2 ms·
A Rust program can trivially return a tuple of values, so it doesn't need out params.
by db48x 4y ago
A Rust program can trivially return a tuple of values, so it doesn't need out params.
- zozbot234 4y agoOut params are needed to ensure zero-copy in-place initialization of large objects, i.e. what C++ does with placement new. You can sort of fake it with MaybeUninit<> https://doc.rust-lang.org/std/mem/union.MaybeUninit.html https://doc.rust-lang.org/std/mem/union.MaybeUninit.html but it's quite fiddly, requires unsafe code, and has undesirable effects on the layout of containing objects.
- db48x 4y agoIn–place initialization is nice to have, but not strictly required.