pub trait Remap where
    Self: Sized
{ fn remap(self, from: Range<Self>, onto: Range<Self>) -> Self; }
Expand description

Represents a type that can be mapped between two ranges.

Required Methods

Remap a value from one range to another. A value outside the bounds of one range will be similarly outside the bounds of the other.

assert_eq!(5.remap(-10..10, -100..100), 50);
assert_eq!(0.5.remap(0.0..1.0, -1.0..1.0), 0.0);

Implementors