diff --git a/src/params.rs b/src/params.rs index 0a226966..860f92cf 100644 --- a/src/params.rs +++ b/src/params.rs @@ -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 /// if the string cannot be parsed. ///