Example #1
0
        private static SwitchContext <TCapture> CreateContext <TCapture>(TCapture capture, CancellationTokenSource cancellationTokenSource)
        {
            var cancellationToken = cancellationTokenSource != null ? cancellationTokenSource.Token : CancellationToken.None;
            var context           = new SwitchContext <TCapture>(capture, cancellationToken);

            return(context);
        }
Example #2
0
 public static SwitchCaseCondition <MochiUnit> UnsafeCase <TCapture>(this SwitchContext <TCapture> _, Task task)
 => UnsafeCase(_, (MochiTask <MochiUnit>)task.ToMochiTask());
Example #3
0
 public static SwitchCaseCondition <MochiUnit> UnsafeDefault <TCapture>(this SwitchContext <TCapture> _)
 => new SwitchCaseCondition <MochiUnit>(true, new Awaiter <MochiUnit>(default(MochiUnit)));
Example #4
0
 public static SwitchCaseCondition <T> UnsafeCase <TCapture, T>(this SwitchContext <TCapture> _, MochiTask <T> task)
 => new SwitchCaseCondition <T>(true, task.GetAwaiter());
Example #5
0
 public static SwitchCaseCondition <T> UnsafeCase <TCapture, T>(this SwitchContext <TCapture> _, Task <T> task)
 => UnsafeCase(_, task.ToMochiTask());