Ejemplo n.º 1
0
            public Logic(SeqStage <T> stage, TaskCompletionSource <IImmutableList <T> > promise) : base(stage.Shape)
            {
                _stage   = stage;
                _promise = promise;

                SetHandler(stage.In, this);
            }
Ejemplo n.º 2
0
            public Logic(SeqStage <T> stage, TaskCompletionSource <IImmutableList <T> > promise) : base(stage.Shape)
            {
                _stage = stage;

                SetHandler(stage._in, onPush: () =>
                {
                    _buf = _buf.Add(Grab(stage._in));
                    Pull(stage._in);
                }, onUpstreamFinish: () =>
                {
                    promise.TrySetResult(_buf);
                    CompleteStage();
                }, onUpstreamFailure: ex =>
                {
                    promise.TrySetException(ex);
                    FailStage(ex);
                });
            }