pub fn map<T: Copy + Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Div<Output = T>>(
value: T,
start1: T,
stop1: T,
start2: T,
stop2: T,
) -> TExpand description
Maps a value from one range to another.
§Arguments
value- A value of typeTrepresenting the value to map.start1- A value of typeTrepresenting the start of the input range.stop1- A value of typeTrepresenting the end of the input range.start2- A value of typeTrepresenting the start of the output range.stop2- A value of typeTrepresenting the end of the output range.
§Returns
A value of type T representing the mapped value.
§Example
let value = 5;
let start1 = 0;
let stop1 = 10;
let start2 = 0;
let stop2 = 100;
let result = cgl_rs::utils::map(value, start1, stop1, start2, stop2);