You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
using System.Threading; |
|
|
|
namespace Cysharp.Threading.Tasks.Linq |
|
{ |
|
public static partial class UniTaskAsyncEnumerable |
|
{ |
|
public static IUniTaskAsyncEnumerable<T> Empty<T>() |
|
{ |
|
return Cysharp.Threading.Tasks.Linq.Empty<T>.Instance; |
|
} |
|
} |
|
|
|
internal class Empty<T> : IUniTaskAsyncEnumerable<T> |
|
{ |
|
public static readonly IUniTaskAsyncEnumerable<T> Instance = new Empty<T>(); |
|
|
|
Empty() |
|
{ |
|
} |
|
|
|
public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default) |
|
{ |
|
return _Empty.Instance; |
|
} |
|
|
|
class _Empty : IUniTaskAsyncEnumerator<T> |
|
{ |
|
public static readonly IUniTaskAsyncEnumerator<T> Instance = new _Empty(); |
|
|
|
_Empty() |
|
{ |
|
} |
|
|
|
public T Current => default; |
|
|
|
public UniTask<bool> MoveNextAsync() |
|
{ |
|
return CompletedTasks.False; |
|
} |
|
|
|
public UniTask DisposeAsync() |
|
{ |
|
return default; |
|
} |
|
} |
|
} |
|
} |