Skip to content

Commit ebb0eaa

Browse files
committed
Remove custom IAsyncEnumerable type to use the standard one.
1 parent 9eec5a9 commit ebb0eaa

File tree

9 files changed

+26
-38
lines changed

9 files changed

+26
-38
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# async-enumerable-dotnet
22

3-
Experimental operators for C# 8 [`IAsyncEnumerable`s](https://github.com/dotnet/corefx/issues/32640).
3+
Experimental operators for C# 8 [`IAsyncEnumerable`s](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1?view=dotnet-plat-ext-3.0).
44

55
Travis-CI: <a href='https://travis-ci.org/akarnokd/async-enumerable-dotnet/builds'><img src='https://travis-ci.org/akarnokd/async-enumerable-dotnet.svg?branch=master' alt="async-enumerable-dotnet"></a>
66
NuGet: <a href='https://www.nuget.org/packages/akarnokd.async-enumerable-dotnet'><img src='https://img.shields.io/nuget/v/akarnokd.async-enumerable-dotnet.svg' alt="async-enumerable-dotnet"/></a>
@@ -11,7 +11,12 @@ Namespace: `async_enumerable_dotnet`
1111

1212
Factory/Extension methods: `AsyncEnumerable`
1313

14+
Requires: .NET Core 3 or later
15+
1416
```cs
17+
using async_enumerable_dotnet;
18+
using System.Collections.Generic;
19+
1520
var result = AsyncEnumerable.Range(1, 10)
1621
.Filter(v => v % 2 == 0)
1722
.Map(v => v * 2)

async-enumerable-dotnet-benchmark/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using async_enumerable_dotnet;
66
using System;
7+
using System.Collections.Generic;
78

89
namespace async_enumerable_dotnet_benchmark
910
{

async-enumerable-dotnet-test/AsyncEnumerableTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,18 @@ static AsyncEnumerableTest()
190190
Defaults.Add(typeof(long), 1L);
191191

192192
Defaults.Add(typeof(IEnumerable<int>), Enumerable.Empty<int>());
193-
Defaults.Add(typeof(async_enumerable_dotnet.IAsyncEnumerable<int>), AsyncEnumerable.Empty<int>());
194-
Defaults.Add(typeof(async_enumerable_dotnet.IAsyncEnumerable<int>[]), new[] { AsyncEnumerable.Empty<int>() });
193+
Defaults.Add(typeof(IAsyncEnumerable<int>), AsyncEnumerable.Empty<int>());
194+
Defaults.Add(typeof(IAsyncEnumerable<int>[]), new[] { AsyncEnumerable.Empty<int>() });
195195

196196
Defaults.Add(typeof(Func<int>), (Func<int>)(() => 1));
197197
Defaults.Add(typeof(Func<int, bool>), (Func<int, bool>)(v => true));
198198
Defaults.Add(typeof(Func<int, int>), (Func<int, int>)(v => v));
199199
Defaults.Add(typeof(Func<int, int, int>), (Func<int, int, int>)((v, w) => v));
200200
Defaults.Add(typeof(Func<int[], int>), (Func<int[], int>)(v => v[0]));
201-
Defaults.Add(typeof(Func<async_enumerable_dotnet.IAsyncEnumerable<int>>), (Func<async_enumerable_dotnet.IAsyncEnumerable<int>>)AsyncEnumerable.Empty<int>);
201+
Defaults.Add(typeof(Func<IAsyncEnumerable<int>>), (Func<IAsyncEnumerable<int>>)AsyncEnumerable.Empty<int>);
202202
Defaults.Add(typeof(Func<int, IEnumerable<int>>), (Func<int, IEnumerable<int>>)(v => Enumerable.Empty<int>()));
203-
Defaults.Add(typeof(Func<int, async_enumerable_dotnet.IAsyncEnumerable<int>>), (Func<int, async_enumerable_dotnet.IAsyncEnumerable<int>>)(v => AsyncEnumerable.Empty<int>()));
204-
Defaults.Add(typeof(Func<Exception, async_enumerable_dotnet.IAsyncEnumerable<int>>), (Func<Exception, async_enumerable_dotnet.IAsyncEnumerable<int>>)(v => AsyncEnumerable.Empty<int>()));
203+
Defaults.Add(typeof(Func<int, IAsyncEnumerable<int>>), (Func<int, IAsyncEnumerable<int>>)(v => AsyncEnumerable.Empty<int>()));
204+
Defaults.Add(typeof(Func<Exception, IAsyncEnumerable<int>>), (Func<Exception, IAsyncEnumerable<int>>)(v => AsyncEnumerable.Empty<int>()));
205205
Defaults.Add(typeof(Func<int, Task>), (Func<int, Task>)(v => null));
206206
Defaults.Add(typeof(Func<int, Task<int>>), (Func<int, Task<int>>)(v => null));
207207
Defaults.Add(typeof(Func<int, Task<bool>>), (Func<int, Task<bool>>)(v => null));
@@ -214,7 +214,7 @@ static AsyncEnumerableTest()
214214
Defaults.Add(typeof(Func<long, Task<bool>>), (Func<long, Task<bool>>)(v => Task.FromResult(false)));
215215
Defaults.Add(typeof(Func<ISet<int>>), (Func<ISet<int>>)(() => null));
216216

217-
Defaults.Add(typeof(Func<async_enumerable_dotnet.IAsyncEnumerable<int>, async_enumerable_dotnet.IAsyncEnumerable<int>>), (Func<async_enumerable_dotnet.IAsyncEnumerable<int>, async_enumerable_dotnet.IAsyncEnumerable<int>>)(w => w));
217+
Defaults.Add(typeof(Func<IAsyncEnumerable<int>, IAsyncEnumerable<int>>), (Func<IAsyncEnumerable<int>, IAsyncEnumerable<int>>)(w => w));
218218

219219
Defaults.Add(typeof(Action), (Action)(() => { }));
220220
Defaults.Add(typeof(Action<int>), (Action<int>)(v => { }));

async-enumerable-dotnet-test/ConcatTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ await AsyncEnumerable.Concat(
2828
[Fact]
2929
public async void Enumerable_Normal()
3030
{
31-
await AsyncEnumerable.Concat((IEnumerable<async_enumerable_dotnet.IAsyncEnumerable<int>>)new[] {
31+
await AsyncEnumerable.Concat((IEnumerable<IAsyncEnumerable<int>>)new[] {
3232
AsyncEnumerable.Range(1, 3),
3333
AsyncEnumerable.Empty<int>(),
3434
AsyncEnumerable.FromArray(4, 5, 6, 7),

async-enumerable-dotnet-test/TestHelper.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace async_enumerable_dotnet_test
1616
{
1717
internal static class TestHelper
1818
{
19-
public static ValueTask AssertResult<T>(this async_enumerable_dotnet.IAsyncEnumerable<T> source, params T[] values)
19+
public static ValueTask AssertResult<T>(this IAsyncEnumerable<T> source, params T[] values)
2020
{
2121
return AssertResult(source.GetAsyncEnumerator(default), values);
2222
}
@@ -68,18 +68,18 @@ public static async ValueTask AssertResult<T>(this IAsyncEnumerator<T> source, p
6868
}
6969
}
7070

71-
public static async ValueTask AssertThen<T>(this async_enumerable_dotnet.IAsyncEnumerable<T> source, Action<IList<T>> outcomeHandler)
71+
public static async ValueTask AssertThen<T>(this IAsyncEnumerable<T> source, Action<IList<T>> outcomeHandler)
7272
{
7373
var list = await source.ToListAsync();
7474
outcomeHandler(list);
7575
}
7676

77-
public static ValueTask AssertResultSet<T>(this async_enumerable_dotnet.IAsyncEnumerable<T> source, params T[] values)
77+
public static ValueTask AssertResultSet<T>(this IAsyncEnumerable<T> source, params T[] values)
7878
{
7979
return AssertResultSet(source, EqualityComparer<T>.Default, values);
8080
}
8181

82-
public static async ValueTask AssertResultSet<T>(this async_enumerable_dotnet.IAsyncEnumerable<T> source, IEqualityComparer<T> comparer, params T[] values)
82+
public static async ValueTask AssertResultSet<T>(this IAsyncEnumerable<T> source, IEqualityComparer<T> comparer, params T[] values)
8383
{
8484
var set = new HashSet<T>(values, comparer);
8585
var en = source.GetAsyncEnumerator(default);
@@ -121,7 +121,7 @@ private static string AsString(object obj)
121121
return obj != null ? obj.ToString() : "null";
122122
}
123123

124-
public static ValueTask AssertFailure<T>(this async_enumerable_dotnet.IAsyncEnumerable<T> source, Type exception, params T[] values)
124+
public static ValueTask AssertFailure<T>(this IAsyncEnumerable<T> source, Type exception, params T[] values)
125125
{
126126
return AssertFailure(source.GetAsyncEnumerator(default), exception, values);
127127
}
@@ -164,7 +164,7 @@ public static async ValueTask AssertFailure<T>(this IAsyncEnumerator<T> source,
164164
/// </summary>
165165
/// <param name="timestamps">The params array of timestamps.</param>
166166
/// <returns>The new IAsyncEnumerable sequence.</returns>
167-
internal static async_enumerable_dotnet.IAsyncEnumerable<long> TimeSequence(params long[] timestamps)
167+
internal static IAsyncEnumerable<long> TimeSequence(params long[] timestamps)
168168
{
169169
return AsyncEnumerable.FromArray(timestamps)
170170
.FlatMap(v => AsyncEnumerable.Timer(TimeSpan.FromMilliseconds(v)).Map(w => v));
@@ -177,7 +177,7 @@ internal static async_enumerable_dotnet.IAsyncEnumerable<long> TimeSequence(para
177177
/// <param name="error">Th error to append</param>
178178
/// <typeparam name="TSource">The element type of the sequence</typeparam>
179179
/// <returns>The new IAsyncEnumerable instance.</returns>
180-
internal static async_enumerable_dotnet.IAsyncEnumerable<TSource> WithError<TSource>(this async_enumerable_dotnet.IAsyncEnumerable<TSource> source, Exception error)
180+
internal static IAsyncEnumerable<TSource> WithError<TSource>(this IAsyncEnumerable<TSource> source, Exception error)
181181
{
182182
return source.ConcatWith(AsyncEnumerable.Error<TSource>(error));
183183
}

async-enumerable-dotnet/AsyncEnumerableAPI.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

async-enumerable-dotnet/IAsyncGroupedEnumerable.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
// Licensed under the Apache 2.0 License.
33
// See LICENSE file in the project root for full license information.
44

5+
using System.Collections.Generic;
6+
57
namespace async_enumerable_dotnet
68
{
79
/// <summary>
810
/// An IAsyncEnumerable with a key property to support grouping operations.
911
/// </summary>
1012
/// <typeparam name="TKey">The key type.</typeparam>
1113
/// <typeparam name="TValue">The element type of the async sequence.</typeparam>
12-
public interface IAsyncGroupedEnumerable<out TKey, out TValue> : IAsyncEnumerable<TValue>
14+
public interface IAsyncGroupedEnumerable<out TKey, TValue> : IAsyncEnumerable<TValue>
1315
{
1416
/// <summary>
1517
/// Returns the group key.

async-enumerable-dotnet/impl/FirstLastSingleAsync.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using System.Runtime.CompilerServices;
77
using System.Threading.Tasks;
8+
using System.Collections.Generic;
89

910
namespace async_enumerable_dotnet.impl
1011
{

async-enumerable-dotnet/impl/ForEach.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Runtime.CompilerServices;
77
using System.Threading;
88
using System.Threading.Tasks;
9+
using System.Collections.Generic;
910

1011
namespace async_enumerable_dotnet.impl
1112
{

0 commit comments

Comments
 (0)