Function fmt_cmp::int::cmp_dec[][src]

pub fn cmp_dec<T: Integer>(lhs: T, rhs: T) -> Ordering
Expand description

Lexicographically compares the digits of two integers in their decimal representation.

This yields the same result as lhs.to_string().cmp(&rhs.to_string()) without heap allocation.

Example

assert!(fmt_cmp::cmp_dec::<u32>(42, 3).is_gt());
assert!(fmt_cmp::cmp_dec::<u32>(24, 3).is_lt());