Add a getter for parameter units from poitners
This commit is contained in:
parent
186a924104
commit
dfbfc657a8
|
@ -185,6 +185,19 @@ impl ParamPtr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the unit label for this parameter.
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// Calling this function is only safe as long as the object this `ParamPtr` was created for is
|
||||||
|
/// still alive.
|
||||||
|
pub unsafe fn unit(&self) -> &'static str {
|
||||||
|
match &self {
|
||||||
|
ParamPtr::FloatParam(p) => (**p).unit,
|
||||||
|
ParamPtr::IntParam(p) => (**p).unit,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Set this parameter based on a string. Returns whether the updating succeeded. That can fail
|
/// Set this parameter based on a string. Returns whether the updating succeeded. That can fail
|
||||||
/// if the string cannot be parsed.
|
/// if the string cannot be parsed.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue