Skip to main content

numeric_range_contains

Function numeric_range_contains 

Source
pub fn numeric_range_contains(lo: Option<i64>, hi: Option<i64>, n: i64) -> bool
Expand description

!!! WARNING: RUST-ONLY HELPER !!!

There is NO numeric_range_contains() in Src/pattern.c. The C equivalent is the inline bounds test in the P_NUMRNG arm of patmatch() (Src/pattern.c:2810-2910, the case P_NUMRNG: arm), which reads its two zrange_t operands straight out of the bytecode. This standalone form exists only for the transitional extract_numeric_ranges() callers above, which have the bounds as Option<i64> rather than as compiled operands. Dies with the same call sites.

Tests whether n falls within numeric range (lo, hi). Unbounded sides always pass.