Hi All, I am finding myself needing to compare sizes std::num::NonZero<T> with T where T: ZeroablePrimitive, using <, >, =. But since they are not directly comparable, I have to NonZero::<T>::get() each time, and it is quite noisy.
What is the process for requesting or proposing the implementations PartialOrd<NonZero<T>> and PartialEq<NonZero<T>> for T (and the reverse) in the Rust std so that I may compare these values directly?
For a case like this, where you are proposing a simple new trait implementation on existing types, just writing the pull request that adds it suffices. The library team will decide whether to accept it.
In cases involving features other than trait implementations with no particular design decisions to be made, there is more process, starting with an “API Change Proposal” and ending with stabilization. You can read about the process here:
This is the commit that broke things and what was ultimately reverted. Essentially, countless comparisons rely on the fact that there's only one implementation for the given type. It's the same reason you can't directly compare u8 and i8 despite it semantically making sense.