(&self)
| 47 | |
| 48 | impl CommandKillerTrigger<'_> { |
| 49 | pub fn should_abort(&self) -> Option<AbortReason> { |
| 50 | match self { |
| 51 | CommandKillerTrigger::Timeout(since, timeout) => { |
| 52 | if &since.elapsed() >= timeout { |
| 53 | Some(AbortReason::Timeout(*timeout)) |
| 54 | } else { |
| 55 | None |
| 56 | } |
| 57 | } |
| 58 | CommandKillerTrigger::Cancelable(func) => { |
| 59 | if func.status().should_cancel() { |
| 60 | Some(AbortReason::Canceled("Task Canceled".to_string())) |
| 61 | } else { |
| 62 | None |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | pub enum CommandKiller<'a> { |
no test coverage detected