A small generic handler signature used by the SboxSuperuser command discovery code. It validates that a method with one parameter binds to either Func<T1, CommandResult> or Func<T1, Task<CommandResult>> by creating the delegate without invoking it.
namespace SboxSuperuser.Engine.CommandDiscovery;
internal sealed class HandlerSignature1<T1> : IHandlerSignature
{
/// <summary>Checks closed delegate binding without executing the handler.</summary>
public void Validate( Sandbox.MethodDescription method )
{
if ( method.ReturnType == typeof( CommandResult ) )
{
_ = method.CreateDelegate<Func<T1, CommandResult>>();
}
else
{
_ = method.CreateDelegate<Func<T1, Task<CommandResult>>>();
}
}
}