Skip to main content

within

Function within 

Source
pub fn within(value: u64, min: Option<u64>, max: Option<u64>) -> bool
Expand description

Whether a value satisfies an optional >= min / <= max pair (an absent bound never constrains).

ยงExamples

use coding_tools::tree::within;

assert!(within(10, Some(5), Some(20)));
assert!(!within(3, Some(5), None));   // below min
assert!(!within(30, None, Some(20))); // above max
assert!(within(10, None, None));      // unbounded