mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[commands] Deprecate proxy supplier constructor (#6553)
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include <wpi/FunctionExtras.h>
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#include "frc2/command/Command.h"
|
||||
#include "frc2/command/CommandHelper.h"
|
||||
@@ -36,8 +37,16 @@ class ProxyCommand : public CommandHelper<Command, ProxyCommand> {
|
||||
* DeferredCommand} instead.
|
||||
*
|
||||
* @param supplier the command supplier
|
||||
* @deprecated This constructor's similarity to {@link DeferredCommand} is
|
||||
* confusing and opens potential footguns for users who do not fully
|
||||
* understand the semantics and implications of proxying, but who simply want
|
||||
* runtime construction. Users who do know what they are doing and need a
|
||||
* supplier-constructed proxied command should instead proxy a DeferredCommand
|
||||
* using the <code>AsProxy</code> decorator.
|
||||
* @see DeferredCommand
|
||||
*/
|
||||
WPI_IGNORE_DEPRECATED
|
||||
[[deprecated("Proxy a DeferredCommand instead")]]
|
||||
explicit ProxyCommand(wpi::unique_function<Command*()> supplier);
|
||||
|
||||
/**
|
||||
@@ -49,9 +58,17 @@ class ProxyCommand : public CommandHelper<Command, ProxyCommand> {
|
||||
* DeferredCommand} instead.
|
||||
*
|
||||
* @param supplier the command supplier
|
||||
* @deprecated This constructor's similarity to {@link DeferredCommand} is
|
||||
* confusing and opens potential footguns for users who do not fully
|
||||
* understand the semantics and implications of proxying, but who simply want
|
||||
* runtime construction. Users who do know what they are doing and need a
|
||||
* supplier-constructed proxied command should instead proxy a DeferredCommand
|
||||
* using the <code>AsProxy</code> decorator.
|
||||
* @see DeferredCommand
|
||||
*/
|
||||
[[deprecated("Proxy a DeferredCommand instead")]]
|
||||
explicit ProxyCommand(wpi::unique_function<CommandPtr()> supplier);
|
||||
WPI_UNIGNORE_DEPRECATED
|
||||
|
||||
/**
|
||||
* Creates a new ProxyCommand that schedules the given command when
|
||||
|
||||
Reference in New Issue
Block a user