Crate in_range

source ·
Expand description

In range

Returns true if a number is in range.

Usage

First, install the library with

cargo add in_range

Then, in code:

use in_range::in_range;

// Args: value, min, max
let result = in_range(10, 1, 15);

print!("{}", result);
// Prints true;

You can also use not_in_range to return false when value is in range.

use in_range::not_in_range;

// Args: value, min, max
let result = not_in_range(25, 1, 15);

print!("{}", result);
// Prints true;

Functions

Return true if an i32 value is within range.
Return true if a u32 value is within range.
Return false if an i32 value is within range.
Return false if a u32 value is within range.