Function pathfinder::tools::border

source ·
pub fn border(a: u8, b: i32) -> u8
Expand description

Checks so that the applied adjustments stay within a u8.

Examples

use pathfinder::tools;
let a = 50;
let b = 250;
let max = tools::border(a, b);
let zero = tools::border(a, -b);
assert_eq!(max, 255);
assert_eq!(zero, 0);