added result return to get_switch_state #30

Merged
muellerr merged 2 commits from power_abstraction_result_return into power_abstractions 2023-02-07 16:04:40 +01:00
Member

in case an invalid switch_id is given to the function, i.e. a switch_id that the powerswitcher does not implement

in case an invalid switch_id is given to the function, i.e. a switch_id that the powerswitcher does not implement
lkoester added 1 commit 2023-02-07 14:59:38 +01:00
lkoester changed title from added result return to get_switch_state to WIP: added result return to get_switch_state 2023-02-07 14:59:53 +01:00
lkoester changed title from WIP: added result return to get_switch_state to added result return to get_switch_state 2023-02-07 14:59:57 +01:00
lkoester requested review from muellerr 2023-02-07 15:00:09 +01:00
muellerr requested changes 2023-02-07 15:57:54 +01:00
@ -51,3 +51,2 @@
fn get_is_switch_on(&mut self, switch_id: SwitchId) -> bool {
self.get_switch_state(switch_id) == SwitchState::On
fn get_is_switch_on(&mut self, switch_id: SwitchId) -> Result<bool, ()> {
Owner

I think Result<bool, Self::Error> can be returned here by writing self.get_switch_state(..)? == SwitchState::On

I think `Result<bool, Self::Error>` can be returned here by writing `self.get_switch_state(..)? == SwitchState::On`
lkoester marked this conversation as resolved
lkoester added 1 commit 2023-02-07 16:01:03 +01:00
lkoester requested review from muellerr 2023-02-07 16:01:26 +01:00
muellerr approved these changes 2023-02-07 16:04:33 +01:00
muellerr merged commit 69c97459fb into power_abstractions 2023-02-07 16:04:40 +01:00
muellerr deleted branch power_abstraction_result_return 2023-02-07 16:04:41 +01:00
muellerr added this to the satrs v0.1.0 milestone 2023-02-14 16:32:38 +01:00
Sign in to join this conversation.
No description provided.