simplified get is switch on
This commit is contained in:
parent
be1299e7d6
commit
ae8718ed6a
@ -49,11 +49,8 @@ pub trait PowerSwitcher {
|
|||||||
/// Retrieve the switch state
|
/// Retrieve the switch state
|
||||||
fn get_switch_state(&mut self, switch_id: SwitchId) -> Result<SwitchState, Self::Error>;
|
fn get_switch_state(&mut self, switch_id: SwitchId) -> Result<SwitchState, Self::Error>;
|
||||||
|
|
||||||
fn get_is_switch_on(&mut self, switch_id: SwitchId) -> Result<bool, ()> {
|
fn get_is_switch_on(&mut self, switch_id: SwitchId) -> Result<bool, Self::Error> {
|
||||||
match self.get_switch_state(switch_id) {
|
Ok(self.get_switch_state(switch_id)? == SwitchState::On)
|
||||||
Ok(switch_state) => { Ok(switch_state == SwitchState::On) }
|
|
||||||
Err(_) => { Err(()) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The maximum delay it will take to change a switch.
|
/// The maximum delay it will take to change a switch.
|
||||||
|
Loading…
Reference in New Issue
Block a user