[commands] Rename deadlineWith to deadlineFor (#6544)

Deprecate deadlineWith for backwards compatibility.
This commit is contained in:
Isaac Turner
2024-04-29 03:02:29 +08:00
committed by GitHub
parent 1ec089c7f9
commit 67fe11f9cd
4 changed files with 44 additions and 2 deletions

View File

@@ -174,6 +174,15 @@ CommandPtr CommandPtr::DeadlineWith(CommandPtr&& parallel) && {
return std::move(*this);
}
CommandPtr CommandPtr::DeadlineFor(CommandPtr&& parallel) && {
AssertValid();
std::vector<std::unique_ptr<Command>> vec;
vec.emplace_back(std::move(parallel).Unwrap());
m_ptr =
std::make_unique<ParallelDeadlineGroup>(std::move(m_ptr), std::move(vec));
return std::move(*this);
}
CommandPtr CommandPtr::AlongWith(CommandPtr&& parallel) && {
AssertValid();
std::vector<std::unique_ptr<Command>> vec;

View File

@@ -191,9 +191,21 @@ class CommandPtr final {
* @param parallel the commands to run in parallel
* @return the decorated command
*/
[[nodiscard]]
[[nodiscard]] [[deprecated("Replace with DeadlineFor")]]
CommandPtr DeadlineWith(CommandPtr&& parallel) &&;
/**
* Decorates this command with a set of commands to run parallel to it, ending
* when the calling command ends and interrupting all the others. Often more
* convenient/less-verbose than constructing a new {@link
* ParallelDeadlineGroup} explicitly.
*
* @param parallel the commands to run in parallel. Note the parallel commands
* will be interupted when the deadline command ends
* @return the decorated command
*/
[[nodiscard]]
CommandPtr DeadlineFor(CommandPtr&& parallel) &&;
/**
* Decorates this command with a set of commands to run parallel to it, ending
* when the last command ends. Often more convenient/less-verbose than