[commands] Add until() as alias for withInterrupt() (#3981)

This is a clearer description for the functionality.
Will deprecate withInterrupt next year.
This commit is contained in:
Oblarg
2022-02-04 01:14:52 -05:00
committed by GitHub
parent 16bf2c70c5
commit 6a6366b0d6
12 changed files with 50 additions and 14 deletions

View File

@@ -37,6 +37,13 @@ ParallelRaceGroup Command::WithTimeout(units::second_t duration) && {
return ParallelRaceGroup(std::move(temp));
}
ParallelRaceGroup Command::Until(std::function<bool()> condition) && {
std::vector<std::unique_ptr<Command>> temp;
temp.emplace_back(std::make_unique<WaitUntilCommand>(std::move(condition)));
temp.emplace_back(std::move(*this).TransferOwnership());
return ParallelRaceGroup(std::move(temp));
}
ParallelRaceGroup Command::WithInterrupt(std::function<bool()> condition) && {
std::vector<std::unique_ptr<Command>> temp;
temp.emplace_back(std::make_unique<WaitUntilCommand>(std::move(condition)));