OxL Reference

method RangeInclusive.contains

lo <= x && x <= hi for any ordered T (D-3563); the same as x in lo..=hi.

Example:

oxl✓ checked in CI
fn main() io {
  print("{(1..=5).contains(&5)} {(1..=5).contains(&6)}")
}
Output
true false
pub(api) fn contains(x: &T) -> bool where T: Ord

Complexity. O(1).

Since. 1.0.0-beta

Parameters

NameType
x&T

Returns

bool where T: Ord

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/iter.oxl:995

See also