Explicitly mark parameter range conversions inline
The compiler already does this, but these should be inlineable.
This commit is contained in:
parent
ae3356dca8
commit
d3cb5f2bee
|
@ -146,6 +146,7 @@ impl Param for BoolParam {
|
||||||
Some(self.preview_normalized(value))
|
Some(self.preview_normalized(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn preview_normalized(&self, plain: Self::Plain) -> f32 {
|
fn preview_normalized(&self, plain: Self::Plain) -> f32 {
|
||||||
if plain {
|
if plain {
|
||||||
1.0
|
1.0
|
||||||
|
@ -154,6 +155,7 @@ impl Param for BoolParam {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn preview_plain(&self, normalized: f32) -> Self::Plain {
|
fn preview_plain(&self, normalized: f32) -> Self::Plain {
|
||||||
normalized > 0.5
|
normalized > 0.5
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,10 +191,12 @@ impl<T: Enum + PartialEq> Param for EnumParam<T> {
|
||||||
self.inner.string_to_normalized_value(string)
|
self.inner.string_to_normalized_value(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn preview_normalized(&self, plain: Self::Plain) -> f32 {
|
fn preview_normalized(&self, plain: Self::Plain) -> f32 {
|
||||||
self.inner.preview_normalized(T::to_index(plain) as i32)
|
self.inner.preview_normalized(T::to_index(plain) as i32)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn preview_plain(&self, normalized: f32) -> Self::Plain {
|
fn preview_plain(&self, normalized: f32) -> Self::Plain {
|
||||||
T::from_index(self.inner.preview_plain(normalized) as usize)
|
T::from_index(self.inner.preview_plain(normalized) as usize)
|
||||||
}
|
}
|
||||||
|
@ -276,10 +278,12 @@ impl Param for EnumParamInner {
|
||||||
.map(|idx| self.preview_normalized(idx as i32))
|
.map(|idx| self.preview_normalized(idx as i32))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn preview_normalized(&self, plain: Self::Plain) -> f32 {
|
fn preview_normalized(&self, plain: Self::Plain) -> f32 {
|
||||||
self.inner.preview_normalized(plain)
|
self.inner.preview_normalized(plain)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn preview_plain(&self, normalized: f32) -> Self::Plain {
|
fn preview_plain(&self, normalized: f32) -> Self::Plain {
|
||||||
self.inner.preview_plain(normalized)
|
self.inner.preview_plain(normalized)
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,10 +180,12 @@ impl Param for FloatParam {
|
||||||
Some(self.preview_normalized(value))
|
Some(self.preview_normalized(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn preview_normalized(&self, plain: Self::Plain) -> f32 {
|
fn preview_normalized(&self, plain: Self::Plain) -> f32 {
|
||||||
self.range.normalize(plain)
|
self.range.normalize(plain)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn preview_plain(&self, normalized: f32) -> Self::Plain {
|
fn preview_plain(&self, normalized: f32) -> Self::Plain {
|
||||||
let value = self.range.unnormalize(normalized);
|
let value = self.range.unnormalize(normalized);
|
||||||
match &self.step_size {
|
match &self.step_size {
|
||||||
|
|
|
@ -164,10 +164,12 @@ impl Param for IntParam {
|
||||||
Some(self.preview_normalized(value))
|
Some(self.preview_normalized(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn preview_normalized(&self, plain: Self::Plain) -> f32 {
|
fn preview_normalized(&self, plain: Self::Plain) -> f32 {
|
||||||
self.range.normalize(plain)
|
self.range.normalize(plain)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn preview_plain(&self, normalized: f32) -> Self::Plain {
|
fn preview_plain(&self, normalized: f32) -> Self::Plain {
|
||||||
self.range.unnormalize(normalized)
|
self.range.unnormalize(normalized)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue