> whereas in Rust you just return a `Vec` and everything is taken care of
The downside is that you just performed a hidden heap allocation. If automatic memory management is desired, a garbage-collected language might have been the better choice in the first place.
Both solution don't use heap allocation but pass around the array data by value on the stack or packed into register and should compile to the same assembly code (ABI differences aside).
That's also one of the rare cases where Rust code actually turns out more simple and readable than the C equivalent ;)
The downside is that you just performed a hidden heap allocation. If automatic memory management is desired, a garbage-collected language might have been the better choice in the first place.