Skip to content

Commit

Permalink
Hide API using Index/Range
Browse files Browse the repository at this point in the history
The polyfills generated by PolySharp cannot be made public as there will be conflicts with the polyfills generated by others.
  • Loading branch information
Bouke committed Jul 16, 2024
1 parent e8308a4 commit 09e9928
Show file tree
Hide file tree
Showing 27 changed files with 137 additions and 39 deletions.
8 changes: 8 additions & 0 deletions Source/SuperLinq.Async/ElementAt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ public static partial class AsyncSuperEnumerable
/// To instead return a default value when the specified index is out of range,
/// use the <see cref="ElementAtOrDefaultAsync{TSource}(IAsyncEnumerable{TSource}, Index, CancellationToken)" /> method.</para>
/// </remarks>
#if NETCOREAPP
public static ValueTask<TSource> ElementAtAsync<TSource>(
#else
internal static ValueTask<TSource> ElementAtAsync<TSource>(
#endif
this IAsyncEnumerable<TSource> source,
Index index,
CancellationToken cancellationToken = default
Expand Down Expand Up @@ -52,7 +56,11 @@ static async ValueTask<TSource> Core(IAsyncEnumerable<TSource> source, Index ind
/// <remarks>
/// <para>The default value for reference and nullable types is <see langword="null" />.</para>
/// </remarks>
#if NETCOREAPP
public static ValueTask<TSource?> ElementAtOrDefaultAsync<TSource>(
#else
internal static ValueTask<TSource?> ElementAtOrDefaultAsync<TSource>(
#endif
this IAsyncEnumerable<TSource> source,
Index index,
CancellationToken cancellationToken = default
Expand Down
8 changes: 8 additions & 0 deletions Source/SuperLinq.Async/FindIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ public static ValueTask<int> FindIndex<TSource>(
/// This operator executes immediately.
/// </para>
/// </remarks>
#if NETCOREAPP
public static ValueTask<int> FindIndex<TSource>(
#else
internal static ValueTask<int> FindIndex<TSource>(
#endif
this IAsyncEnumerable<TSource> source,
Func<TSource, bool> predicate,
Index index,
Expand Down Expand Up @@ -120,7 +124,11 @@ public static ValueTask<int> FindIndex<TSource>(
/// This operator executes immediately.
/// </para>
/// </remarks>
#if NETCOREAPP
public static ValueTask<int> FindIndex<TSource>(
#else
internal static ValueTask<int> FindIndex<TSource>(
#endif
this IAsyncEnumerable<TSource> source,
Func<TSource, bool> predicate,
Index index,
Expand Down
8 changes: 8 additions & 0 deletions Source/SuperLinq.Async/FindLastIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ public static ValueTask<int> FindLastIndex<TSource>(
/// This operator executes immediately.
/// </para>
/// </remarks>
#if NETCOREAPP
public static ValueTask<int> FindLastIndex<TSource>(
#else
internal static ValueTask<int> FindLastIndex<TSource>(
#endif
this IAsyncEnumerable<TSource> source,
Func<TSource, bool> predicate,
Index index,
Expand Down Expand Up @@ -124,7 +128,11 @@ public static ValueTask<int> FindLastIndex<TSource>(
/// This operator executes immediately.
/// </para>
/// </remarks>
#if NETCOREAPP
public static ValueTask<int> FindLastIndex<TSource>(
#else
internal static ValueTask<int> FindLastIndex<TSource>(
#endif
this IAsyncEnumerable<TSource> source,
Func<TSource, bool> predicate,
Index index,
Expand Down
8 changes: 8 additions & 0 deletions Source/SuperLinq.Async/IndexOf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ public static ValueTask<int> IndexOf<TSource>(
/// This operator executes immediately.
/// </para>
/// </remarks>
#if NETCOREAPP
public static ValueTask<int> IndexOf<TSource>(
#else
internal static ValueTask<int> IndexOf<TSource>(
#endif
this IAsyncEnumerable<TSource> source,
TSource item,
Index index,
Expand Down Expand Up @@ -115,7 +119,11 @@ public static ValueTask<int> IndexOf<TSource>(
/// This operator executes immediately.
/// </para>
/// </remarks>
#if NETCOREAPP
public static ValueTask<int> IndexOf<TSource>(
#else
internal static ValueTask<int> IndexOf<TSource>(
#endif
this IAsyncEnumerable<TSource> source,
TSource item,
Index index,
Expand Down
4 changes: 4 additions & 0 deletions Source/SuperLinq.Async/Insert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ static async IAsyncEnumerable<T> Core(
/// yielding the next element after having iterated
/// <paramref name="first"/> entirely.
/// </exception>
#if NETCOREAPP
public static IAsyncEnumerable<T> Insert<T>(this IAsyncEnumerable<T> first, IAsyncEnumerable<T> second, Index index)
#else
internal static IAsyncEnumerable<T> Insert<T>(this IAsyncEnumerable<T> first, IAsyncEnumerable<T> second, Index index)
#endif
{
ArgumentNullException.ThrowIfNull(first);
ArgumentNullException.ThrowIfNull(second);
Expand Down
8 changes: 8 additions & 0 deletions Source/SuperLinq.Async/LastIndexOf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ public static ValueTask<int> LastIndexOf<TSource>(
/// This operator executes immediately.
/// </para>
/// </remarks>
#if NETCOREAPP
public static ValueTask<int> LastIndexOf<TSource>(
#else
internal static ValueTask<int> LastIndexOf<TSource>(
#endif
this IAsyncEnumerable<TSource> source,
TSource item,
Index index,
Expand Down Expand Up @@ -118,7 +122,11 @@ public static ValueTask<int> LastIndexOf<TSource>(
/// This operator executes immediately.
/// </para>
/// </remarks>
#if NETCOREAPP
public static ValueTask<int> LastIndexOf<TSource>(
#else
internal static ValueTask<int> LastIndexOf<TSource>(
#endif
this IAsyncEnumerable<TSource> source,
TSource item,
Index index,
Expand Down
Loading

0 comments on commit 09e9928

Please sign in to comment.