pub trait Scalable {
// Required method
fn scale<R: FromF64>(
self,
from_low: impl ToF64,
from_high: impl ToF64,
to_low: impl ToF64,
to_high: impl ToF64,
) -> R;
}Expand description
Trait for mapping a value from one scale to another.
Required Methods§
Sourcefn scale<R: FromF64>(
self,
from_low: impl ToF64,
from_high: impl ToF64,
to_low: impl ToF64,
to_high: impl ToF64,
) -> R
fn scale<R: FromF64>( self, from_low: impl ToF64, from_high: impl ToF64, to_low: impl ToF64, to_high: impl ToF64, ) -> R
Map a value from one scale to another. This is equivalent to Arduino map() method: https://www.arduino.cc/reference/en/language/functions/math/map/
§Parameters
self: the value to mapfrom_low: the low end of the originating rangefrom_high: the high end of the originating rangeto_low: the low end of the target rangeto_high: the high end of the target range
§Returns
The mapped value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".