Function
assign_sleep_reason
(
previous: Option<SleepReason>,
current: Option<SleepReason>,
need_sleep: bool,
// Whether the signal has actually changed in between firing
signal_changed: bool,
new: SleepRe
Source from the content-addressed store, hash-verified
| 586 | } |
| 587 | |
| 588 | fn assign_sleep_reason( |
| 589 | previous: Option<SleepReason>, |
| 590 | current: Option<SleepReason>, |
| 591 | need_sleep: bool, |
| 592 | // Whether the signal has actually changed in between firing |
| 593 | signal_changed: bool, |
| 594 | new: SleepReason, |
| 595 | ) -> Option<SleepReason> { |
| 596 | if !need_sleep { |
| 597 | None |
| 598 | } else if current.is_some() && (Some(new) == previous || !signal_changed) { |
| 599 | current |
| 600 | } else { |
| 601 | Some(new) |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | // Will do nothing if already in the right state |
| 606 | fn handle_sleep( |
Tested by
no test coverage detected