Where is std::num::Saturating? (Going to pre-RFC!)

I would expect it to be the monadic lift (see Lifting binary operations, e.g. T+T → Option<T> + Option<T> - #8 by scottmcm), so those would be fine, and would just stay None if they're ever None (kinda like a null object pattern).

The particularly interesting thing to me about them is that they should probably be PartialOrd but not Ord -- like in SQL, the None should be neither greater, less, nor equal to zero.

5 Likes