#123·nannou

`MapRange` trait - included with the prelude

Author: mitchmindtreeCreated Jun 4, 2018Updated Jun 12, 2026

A trait abstraction around the map_range function, implemented for all primitive number types. Something like this:

rust
pub trait MapRange {
    fn map_range<T>(self, min: Self, max: Self, min_t: T, max_t: T) -> T;
    fn normalise_range<T>(self, min: Self, max: Self) -> Self;
    fn invert_range<T>(self, min: Self, max: Self) -> Self;
}