|
|
|
@ -186,10 +186,19 @@ impl<T: CommandImp> Command for GenericCommand<T> {
@@ -186,10 +186,19 @@ impl<T: CommandImp> Command for GenericCommand<T> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn reset(&mut self) { |
|
|
|
|
self.context.status = CommandStatus::Stopped; |
|
|
|
|
use self::CommandStatus::*; |
|
|
|
|
self.context.status = match self.context.status { |
|
|
|
|
Ended | Cancelled => Stopped, |
|
|
|
|
other => other, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn cancel(&mut self) { |
|
|
|
|
self.context.status = CommandStatus::Cancelling; |
|
|
|
|
use self::CommandStatus::*; |
|
|
|
|
self.context.status = match self.context.status { |
|
|
|
|
Running => Cancelling, |
|
|
|
|
other => other, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -333,6 +342,7 @@ impl CommandImp for CommandGroupConfig {
@@ -333,6 +342,7 @@ impl CommandImp for CommandGroupConfig {
|
|
|
|
|
let mut command = command.borrow_mut(); |
|
|
|
|
command.cancel(); |
|
|
|
|
command.execute(); |
|
|
|
|
command.reset(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -408,7 +418,10 @@ impl CommandScheduler {
@@ -408,7 +418,10 @@ impl CommandScheduler {
|
|
|
|
|
self.running_commands.drain_filter(|command_run| { |
|
|
|
|
let mut command = command_run.command.borrow_mut(); |
|
|
|
|
match command.execute() { |
|
|
|
|
Ended | Cancelled => true, |
|
|
|
|
Ended | Cancelled => { |
|
|
|
|
command.reset(); |
|
|
|
|
true |
|
|
|
|
}, |
|
|
|
|
Stopped | Running | Cancelling => false, |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|