pub struct ValueConverter { /* private fields */ }Expand description
Converts values between different scales using a specified transform.
Implementations§
Source§impl ValueConverter
impl ValueConverter
Sourcepub fn new(
input_range: Range,
output_range: Range,
transform: Transform,
) -> Self
pub fn new( input_range: Range, output_range: Range, transform: Transform, ) -> Self
Create a new value converter.
Sourcepub fn convert(&self, value: f64) -> f64
pub fn convert(&self, value: f64) -> f64
Convert a value from the input range to the output range.
Sourcepub fn convert_inverse(&self, value: f64) -> f64
pub fn convert_inverse(&self, value: f64) -> f64
Convert a value in the reverse direction (approximate).
Trait Implementations§
Source§impl Clone for ValueConverter
impl Clone for ValueConverter
Source§fn clone(&self) -> ValueConverter
fn clone(&self) -> ValueConverter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ValueConverter
impl !RefUnwindSafe for ValueConverter
impl Send for ValueConverter
impl Sync for ValueConverter
impl Unpin for ValueConverter
impl UnsafeUnpin for ValueConverter
impl !UnwindSafe for ValueConverter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more