Ejemplo n.º 1
0
        public static async ValueTask <HttpRes> ThrowIfError(this ValueTask <HttpRes> task)
        {
            var res = await task.DonotCapture();

            res.ThrowIfError();
            return(res);
        }
Ejemplo n.º 2
0
        public static async ValueTask <ActionEvent <T> > Error <T>(this ValueTask <ActionEvent <T> > @this, Func <Exception, Task> action)
        {
            var result = await @this.DonotCapture();

            if (result.IsError)
            {
                await action(result.Exception);
            }
            return(result);
        }
Ejemplo n.º 3
0
        public static async ValueTask <ActionEvent> Ok(this ValueTask <ActionEvent> @this, Action <object> action)
        {
            var result = await @this.DonotCapture();

            if (result.IsOk)
            {
                action(result.Target);
            }
            return(result);
        }
Ejemplo n.º 4
0
        public static async ValueTask <ActionEvent> Error(this ValueTask <ActionEvent> @this, Action <Exception> action)
        {
            var result = await @this.DonotCapture();

            if (result.IsError)
            {
                action(result.Exception);
            }
            return(result);
        }
Ejemplo n.º 5
0
        public static async ValueTask <ActionEvent <T> > Ok <T>(this ValueTask <ActionEvent <T> > @this, Func <T, Task> action)
        {
            var result = await @this.DonotCapture();

            if (result.IsOk)
            {
                await action(result.Result);
            }
            return(result);
        }
Ejemplo n.º 6
0
        public static async ValueTask <T> On <T>(this ValueTask <T> t, Func <T, bool> condition, Func <T, ValueTask> action)
        {
            var r = await t.DonotCapture();

            if (condition(r))
            {
                await action(r).DonotCapture();
            }
            return(r);
        }
Ejemplo n.º 7
0
        public static async ValueTask <ActionEvent <T> > ToExplicit <T>(this ValueTask <ActionEvent> @this)
        {
            var result = await @this.DonotCapture();

            return(result.ToExplicit <T>());
        }