Function bound

Source
pub fn bound(b: Bound<&usize>, lower: bool) -> Option<usize>
Expand description

Gets the bound of a rust range object

    assert_eq!(bound((2..).end_bound(), true), None);
    assert_eq!(bound((..2).end_bound(), false), Some(1));
    assert_eq!(bound((..=2).end_bound(), false), Some(2));
    assert_eq!(bound((..2).start_bound(), true), None);
    assert_eq!(bound((0..).start_bound(), false), Some(0));