rust-lang/rust — pull request #15926 by Gankro (2014-07-23 18:01:03+00:00)
Title: extending Saturating to include other arithmetic operations

I see no reason not to support mul/div here. Div is perhaps a bit over-engineered since there's no plausible mechanism to get to the min_value branch using our integer types (which are the only ones we support right now). Still, a theoretical Num type could reach there.

I'm a bit irked that I basically regress the div-by-zero checking provided by CheckedDiv, but I see no way to reasonably handle it.

I can't seem to find *any* existing tests for Saturating. I'd be more than happy to write tests if someone could point me to the right place.