#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) #pragma warning disable CS1591 using System.Runtime.CompilerServices; namespace UniRx.Async { public enum AwaiterStatus { /// The operation has not yet completed. Pending = 0, /// The operation completed successfully. Succeeded = 1, /// The operation completed with an error. Faulted = 2, /// The operation completed due to cancellation. Canceled = 3 } public interface IAwaiter : ICriticalNotifyCompletion { AwaiterStatus Status { get; } bool IsCompleted { get; } void GetResult(); } public interface IAwaiter : IAwaiter { new T GetResult(); } public static class AwaiterStatusExtensions { /// != Pending. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsCompleted(this AwaiterStatus status) { return status != AwaiterStatus.Pending; } /// == Succeeded. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsCompletedSuccessfully(this AwaiterStatus status) { return status == AwaiterStatus.Succeeded; } /// == Canceled. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsCanceled(this AwaiterStatus status) { return status == AwaiterStatus.Canceled; } /// == Faulted. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsFaulted(this AwaiterStatus status) { return status == AwaiterStatus.Faulted; } } } #endif