Overengineering max(a, b)
Mixed comparison functions, common references, and Rust’s lifetime annotations
max
is a function that returns the maximum of two numbers.
While it seems simple on the surface, there are some nuances if you want to make it fully generic.
For starters, what is max(-1, 1u)
or max(lvalue, prvalue)
?
Let’s go on a journey of overengineering max
.
We’ll …