Re:Should Small Rust Structs be Passed by-copy or by-borrow?
by saghm on Saturday December 31, 2022 @02:22PM
(#34199740)
I don't think one of them is more clear or maintainable universally, but in a lot of contexts, there might be an obvious choice. As a trivial example (that isn't quite fair given that the topic is about structs), it will almost never be more clear or maintainable to pass a shared reference to an integer (although there may be cases where a mutable reference might make sense). I don't think there's much need for one to have precedence over the other by default; if anything, I see the discussion about performance tradeoffs not being worth fretting about in the absence of actual measurement to be an argument _against_ one of them being inherently preferable.
[ Parent
| on HN ]
There are no comments on this comment yet.