pub fn ge<ExpectedT>(expected: ExpectedT) -> GeMatcher<ExpectedT>Expand description
Matches a value greater than or equal to (in the sense of >=) expected.
The types of ActualT of actual and ExpectedT of expected must be
comparable via the PartialOrd trait. Namely, ActualT must implement
PartialOrd<ExpectedT>.
verify_that!(1, ge(0))?; // Passes
verify_that!(0, ge(1))?; // FailsIn most cases the params neeed to be the same type or they need to be cast explicitly. This can be surprising when comparing integer types or references:
ⓘ
verify_that!(123u32, ge(0u64))?; // Does not compile
verify_that!(123u32 as u64, ge(0u64))?; // Passesⓘ
let actual: &u32 = &2;
let expected: u32 = 0;
verify_that!(actual, ge(expected))?; // Does not compilelet actual: &u32 = &2;
let expected: u32 = 0;
verify_that!(actual, ge(&expected))?; // Compiles and passesYou can find the standard library PartialOrd implementation in
https://doc.rust-lang.org/core/cmp/trait.PartialOrd.html#implementors