Add Params::set_cmd and use SystemMessage constants

This commit is contained in:
Alexander Krotov
2019-10-25 18:16:18 +03:00
committed by Floris Bruynooghe
parent dced1932b3
commit cfa69cf35a
5 changed files with 14 additions and 7 deletions

View File

@@ -189,6 +189,11 @@ impl Params {
.unwrap_or_default()
}
/// Set the parameter behind `Param::Cmd`.
pub fn set_cmd(&mut self, value: SystemMessage) {
self.set_int(Param::Cmd, value as i32);
}
/// Get the given parameter and parse as `f64`.
pub fn get_float(&self, key: Param) -> Option<f64> {
self.get(key).and_then(|s| s.parse().ok())