pub fn option_max<L, R>(value: &Option<L>, max_value: R) -> Result<()>where
    L: PartialOrd<R> + Display,
    R: Display,
Expand description

Check that an optional value is either none or less than a value

let x = None::<u64>;
assert!(option_max(&x, 1).is_ok());
assert!(option_max(&Some(1.0), 2.0).is_ok());
assert!(option_max(&Some(3), 2).is_err());