Ratio's implementation of ToPrimitive methods currently looks like this:
fn to_u64(&self) -> Option<u64> {
self.to_integer().to_u64()
}
But the documentation for to_u64 in the ToPrimitive trait states (emphasis added):
Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned.
The current implementation doesn't match the documentation. Non-integral Ratio values cannot be represented as u64, so calling to_u64 on them should return None according to the documentation. Instead, it returns the rounded value, provided it is within the range of a u64.
Either the implementation or the documentation should be adjusted.