Function pathfinder::tools::border
source · 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);