Also, even if somebody did insist on explicit mut-output pattern in Rust anyway, they would quickly realize that they need to initialize the value before getting a mutable reference to it - Rust NEVER allows access to uninitialized memory (other than unsafe blocks where you can trick Rust into accesing uninitialized memory and cause undefined behavior by using `std::mem::uninitialized`). The noise related to it should hint that this is not the intended way to do it. Here is a code example to clarify what I mean.
fn write2(out: &mut i32) {
*out = 2;
}
fn main() {
let mut two;
write2(&mut two);
}
And error message: error[E0381]: use of possibly uninitialized variable: `two`
--> src/main.rs:7:17
|
7 | write2(&mut two);
| ^^^ use of possibly uninitialized `two`
Fixing that requires explicitly writing a value into `two`, for instance with `let mut two = 0`, which for complex structs... yeah, you may as well return a struct directly instead of bothering with pointer output.[std::mem::uninitialized]: https://doc.rust-lang.org/std/mem/fn.uninitialized.html
It just memsets the entire thing to 0, which in Rust would
1. require unsafe{}
2. most likely be UB as the struct looks like it has a bunch of pointers which would not be nullable (e.g. arrays)
And therefore not be done at all, or rejected by reviewers if attempted.