Hacker News new | ask | show | jobs
by masklinn 1267 days ago
> * Sprinkling & around everything in math expressions does make them ugly. Maybe rust needs an asBorrow or similar?

Do you mean AsRef, or do you mean magic which automatically borrows parameters and is specifically what rust does not do any more than e.g. C does?

Though you can probably get both if the by-ref version is faster (or more convenient internally): wrap the by-ref function with a by-value wrapper which is #[inline]-ed, this way the interface is by value but the actual parameter passing is byref (as the value-consuming wrapper will be inlined and essentially removed).