mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[commands] Add DeferredCommand (#5566)
Allows commands to be constructed at runtime without proxying.
This commit is contained in:
@@ -142,6 +142,16 @@ CommandPtr Select(std::function<Key()> selector,
|
||||
return SelectCommand(std::move(selector), std::move(vec)).ToPtr();
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the command supplied by the supplier.
|
||||
*
|
||||
* @param supplier the command supplier
|
||||
* @param requirements the set of requirements for this command
|
||||
*/
|
||||
[[nodiscard]]
|
||||
CommandPtr Defer(wpi::unique_function<CommandPtr()> supplier,
|
||||
Requirements requirements);
|
||||
|
||||
/**
|
||||
* Constructs a command that schedules the command returned from the supplier
|
||||
* when initialized, and ends when it is no longer scheduled. The supplier is
|
||||
|
||||
Reference in New Issue
Block a user