Add a function for getting pointers from params
So we don't need to implement this ad-hoc. That would even be impossible to do correctly inside of the proc macro.
This commit is contained in:
parent
4cd9c6d3d3
commit
3f2f932a55
|
@ -144,7 +144,7 @@ impl ParamPtr {
|
|||
}
|
||||
|
||||
macro_rules! impl_plainparam {
|
||||
($ty:ty) => {
|
||||
($ty:ident) => {
|
||||
impl $ty {
|
||||
/// Set this parameter based on a string. Returns whether the updating succeeded. That
|
||||
/// can fail if the string cannot be parsed.
|
||||
|
@ -176,6 +176,11 @@ macro_rules! impl_plainparam {
|
|||
pub fn set_normalized_value(&mut self, normalized: f32) {
|
||||
self.value = self.range.unnormalize(normalized);
|
||||
}
|
||||
|
||||
/// Implementation detail for implementing [Params]. This should not be used directly.
|
||||
pub fn as_ptr(&self) -> ParamPtr {
|
||||
ParamPtr::$ty(self as *const $ty as *mut $ty)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue