don't forget to reset
This commit is contained in:
parent
f5c520816e
commit
3441990817
@ -186,10 +186,19 @@ impl<T: CommandImp> Command for GenericCommand<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self) {
|
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) {
|
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 {
|
|||||||
let mut command = command.borrow_mut();
|
let mut command = command.borrow_mut();
|
||||||
command.cancel();
|
command.cancel();
|
||||||
command.execute();
|
command.execute();
|
||||||
|
command.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -408,7 +418,10 @@ impl CommandScheduler {
|
|||||||
self.running_commands.drain_filter(|command_run| {
|
self.running_commands.drain_filter(|command_run| {
|
||||||
let mut command = command_run.command.borrow_mut();
|
let mut command = command_run.command.borrow_mut();
|
||||||
match command.execute() {
|
match command.execute() {
|
||||||
Ended | Cancelled => true,
|
Ended | Cancelled => {
|
||||||
|
command.reset();
|
||||||
|
true
|
||||||
|
},
|
||||||
Stopped | Running | Cancelling => false,
|
Stopped | Running | Cancelling => false,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user