public Logic(TaskCompletionSource <T> promise, FirstOrDefaultStage <T> stage) : base(stage.Shape) { _promise = promise; _stage = stage; SetHandler(stage.In, this); }
public Logic(TaskCompletionSource <T> promise, FirstOrDefaultStage <T> stage) : base(stage.Shape) { _stage = stage; SetHandler(stage.In, onPush: () => { promise.TrySetResult(Grab(stage.In)); CompleteStage(); }, onUpstreamFinish: () => { promise.TrySetResult(default(T)); CompleteStage(); }, onUpstreamFailure: cause => { promise.TrySetException(cause); FailStage(cause); }); }