Replace try_set with set_if_ok

This commit is contained in:
Aaron Fenyes 2025-03-03 11:43:43 -08:00
parent 874c823dbe
commit 894931a6e7
2 changed files with 11 additions and 10 deletions

View file

@ -181,13 +181,11 @@ pub struct Regulator {
}
impl Regulator {
pub fn try_set(&self, set_pt_spec: String) -> bool {
match SpecifiedValue::try_from(set_pt_spec) {
Ok(set_pt) => {
self.set_point.set(set_pt);
true
}
Err(_) => false
/* TO DO */
// if it's called for, add a `set` method that takes a bare SpecifiedValue
pub fn set_if_ok<E>(&self, set_pt_result: Result<SpecifiedValue, E>) {
if let Ok(set_pt) = set_pt_result {
self.set_point.set(set_pt);
}
}
}