diff --git a/Directory.Build.props b/Directory.Build.props
index ce2d72bbe..524dd9410 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -3,10 +3,11 @@
Antao Almada
- Copyright 2019-2021 Antao Almada
+ Copyright 2019-2023 Antao Almada
latest
strict
enable
+ enable
diff --git a/NetFabric.Hyperlinq.Abstractions/ActionWrapper.cs b/NetFabric.Hyperlinq.Abstractions/ActionWrapper.cs
new file mode 100644
index 000000000..9d9851463
--- /dev/null
+++ b/NetFabric.Hyperlinq.Abstractions/ActionWrapper.cs
@@ -0,0 +1,267 @@
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace NetFabric.Hyperlinq;
+
+///
+/// Represents a read-only struct that wraps an delegate
+/// and implements the interface to provide a way to invoke the action.
+///
+/// The type of the argument to be passed to the action when invoked.
+///
+/// Initializes a new instance of the struct with the specified action.
+///
+/// The delegate to be wrapped.
+/// Thrown if is null.
+[StructLayout(LayoutKind.Auto)]
+public readonly struct ActionWrapper(Action action)
+ : IAction
+{
+ readonly Action action
+ = action ?? Throw.ArgumentNullException>(nameof(action));
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ void IAction.Invoke(ref readonly T arg)
+ => action(arg);
+
+ public static implicit operator ActionWrapper(Action action)
+ => new(action);
+}
+
+///
+/// Represents a read-only struct that wraps an delegate
+/// and implements the interface to provide a way to invoke the action.
+///
+/// The type of the first argument to be passed to the action when invoked.
+/// The type of the second argument to be passed to the action when invoked.
+///
+/// Initializes a new instance of the struct with the specified action.
+///
+/// The delegate to be wrapped.
+/// Thrown if is null.
+[StructLayout(LayoutKind.Auto)]
+public readonly struct ActionWrapper(Action action)
+ : IAction
+{
+ readonly Action action
+ = action ?? Throw.ArgumentNullException>(nameof(action));
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ void IAction.Invoke(ref readonly T1 arg1, ref readonly T2 arg2)
+ => action(arg1, arg2);
+
+ public static implicit operator ActionWrapper(Action action)
+ => new(action);
+}
+
+///
+/// Represents a read-only struct that wraps an delegate
+/// and implements the interface to provide a way to invoke the action.
+///
+/// The type of the first argument to be passed to the action when invoked.
+/// The type of the second argument to be passed to the action when invoked.
+/// The type of the third argument to be passed to the action when invoked.
+///
+/// Initializes a new instance of the struct with the specified action.
+///
+/// The delegate to be wrapped.
+/// Thrown if is null.
+[StructLayout(LayoutKind.Auto)]
+public readonly struct ActionWrapper(Action action)
+ : IAction
+{
+ readonly Action action
+ = action ?? Throw.ArgumentNullException>(nameof(action));
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ void IAction.Invoke(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3)
+ => action(arg1, arg2, arg3);
+
+ public static implicit operator ActionWrapper(Action action)
+ => new(action);
+}
+
+///
+/// Represents a read-only struct that wraps an delegate
+/// and implements the interface to provide a way to invoke the action.
+///
+/// The type of the first argument to be passed to the action when invoked.
+/// The type of the second argument to be passed to the action when invoked.
+/// The type of the third argument to be passed to the action when invoked.
+/// The type of the fourth argument to be passed to the action when invoked.
+///
+/// Initializes a new instance of the struct with the specified action.
+///
+/// The delegate to be wrapped.
+/// Thrown if is null.
+[StructLayout(LayoutKind.Auto)]
+public readonly struct ActionWrapper(Action action)
+ : IAction
+{
+ readonly Action action
+ = action ?? Throw.ArgumentNullException>(nameof(action));
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ void IAction.Invoke(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, ref readonly T4 arg4)
+ => action(arg1, arg2, arg3, arg4);
+
+ public static implicit operator ActionWrapper(Action action)
+ => new(action);
+}
+
+///
+/// Represents a read-only struct that wraps an delegate
+/// and implements the interface to provide a way to invoke the action.
+///
+/// The type of the first argument to be passed to the action when invoked.
+/// The type of the second argument to be passed to the action when invoked.
+/// The type of the third argument to be passed to the action when invoked.
+/// The type of the fourth argument to be passed to the action when invoked.
+/// The type of the fifth argument to be passed to the action when invoked.
+///
+/// Initializes a new instance of the struct with the specified action.
+///
+/// The delegate to be wrapped.
+/// Thrown if is null.
+[StructLayout(LayoutKind.Auto)]
+public readonly struct ActionWrapper(Action action)
+ : IAction
+{
+ readonly Action action
+ = action ?? Throw.ArgumentNullException>(nameof(action));
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ void IAction.Invoke(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, ref readonly T4 arg4, ref readonly T5 arg5)
+ => action(arg1, arg2, arg3, arg4, arg5);
+
+ public static implicit operator ActionWrapper(Action action)
+ => new(action);
+}
+
+///
+/// Represents a read-only struct that wraps an delegate
+/// and implements the interface to provide a way to invoke the action.
+///
+/// The type of the first argument to be passed to the action when invoked.
+/// The type of the second argument to be passed to the action when invoked.
+/// The type of the third argument to be passed to the action when invoked.
+/// The type of the fourth argument to be passed to the action when invoked.
+/// The type of the fifth argument to be passed to the action when invoked.
+/// The type of the sixth argument to be passed to the action when invoked.
+///
+/// Initializes a new instance of the struct with the specified action.
+///
+/// The delegate to be wrapped.
+/// Thrown if is null.
+[StructLayout(LayoutKind.Auto)]
+public readonly struct ActionWrapper(Action action)
+ : IAction
+{
+ readonly Action action
+ = action ?? Throw.ArgumentNullException>(nameof(action));
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ void IAction.Invoke(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, ref readonly T4 arg4, ref readonly T5 arg5, ref readonly T6 arg6)
+ => action(arg1, arg2, arg3, arg4, arg5, arg6);
+
+ public static implicit operator ActionWrapper(Action action)
+ => new(action);
+}
+
+///
+/// Represents a read-only struct that wraps an delegate
+/// and implements the interface to provide a way to invoke the action.
+///
+/// The type of the first argument to be passed to the action when invoked.
+/// The type of the second argument to be passed to the action when invoked.
+/// The type of the third argument to be passed to the action when invoked.
+/// The type of the fourth argument to be passed to the action when invoked.
+/// The type of the fifth argument to be passed to the action when invoked.
+/// The type of the sixth argument to be passed to the action when invoked.
+/// The type of the seventh argument to be passed to the action when invoked.
+///
+/// Initializes a new instance of the struct with the specified action.
+///
+/// The delegate to be wrapped.
+/// Thrown if is null.
+[StructLayout(LayoutKind.Auto)]
+public readonly struct ActionWrapper(Action action)
+ : IAction
+{
+ readonly Action action
+ = action ?? Throw.ArgumentNullException>(nameof(action));
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ void IAction.Invoke(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, ref readonly T4 arg4, ref readonly T5 arg5, ref readonly T6 arg6, ref readonly T7 arg7)
+ => action(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+
+ public static implicit operator ActionWrapper(Action action)
+ => new(action);
+}
+
+///
+/// Represents a read-only struct that wraps an delegate
+/// and implements the interface to provide a way to invoke the action.
+///
+/// The type of the first argument to be passed to the action when invoked.
+/// The type of the second argument to be passed to the action when invoked.
+/// The type of the third argument to be passed to the action when invoked.
+/// The type of the fourth argument to be passed to the action when invoked.
+/// The type of the fifth argument to be passed to the action when invoked.
+/// The type of the sixth argument to be passed to the action when invoked.
+/// The type of the seventh argument to be passed to the action when invoked.
+/// The type of the eighth argument to be passed to the action when invoked.
+///
+/// Initializes a new instance of the struct with the specified action.
+///
+/// The delegate to be wrapped.
+/// Thrown if is null.
+[StructLayout(LayoutKind.Auto)]
+public readonly struct ActionWrapper(Action action)
+ : IAction
+{
+ readonly Action action
+ = action ?? Throw.ArgumentNullException>(nameof(action));
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ void IAction.Invoke(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, ref readonly T4 arg4, ref readonly T5 arg5, ref readonly T6 arg6, ref readonly T7 arg7, ref readonly T8 arg8)
+ => action(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+
+ public static implicit operator ActionWrapper(Action action)
+ => new(action);
+}
+
+///
+/// Represents a read-only struct that wraps an delegate
+/// and implements the interface to provide a way to invoke the action.
+///
+/// The type of the first argument to be passed to the action when invoked.
+/// The type of the second argument to be passed to the action when invoked.
+/// The type of the third argument to be passed to the action when invoked.
+/// The type of the fourth argument to be passed to the action when invoked.
+/// The type of the fifth argument to be passed to the action when invoked.
+/// The type of the sixth argument to be passed to the action when invoked.
+/// The type of the seventh argument to be passed to the action when invoked.
+/// The type of the eighth argument to be passed to the action when invoked.
+/// The type of the ninth argument to be passed to the action when invoked.
+///
+/// Initializes a new instance of the struct with the specified action.
+///
+/// The delegate to be wrapped.
+/// Thrown if is null.
+[StructLayout(LayoutKind.Auto)]
+public readonly struct ActionWrapper(Action action)
+ : IAction
+{
+ readonly Action action
+ = action ?? Throw.ArgumentNullException>(nameof(action));
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ void IAction.Invoke(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, ref readonly T4 arg4, ref readonly T5 arg5, ref readonly T6 arg6, ref readonly T7 arg7, ref readonly T8 arg8, ref readonly T9 arg9)
+ => action(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+
+ public static implicit operator ActionWrapper(Action action)
+ => new(action);
+}
+
+
diff --git a/NetFabric.Hyperlinq.Abstractions/AsyncFunctionWrapper.cs b/NetFabric.Hyperlinq.Abstractions/AsyncFunctionWrapper.cs
index 866062a99..ab9c86445 100644
--- a/NetFabric.Hyperlinq.Abstractions/AsyncFunctionWrapper.cs
+++ b/NetFabric.Hyperlinq.Abstractions/AsyncFunctionWrapper.cs
@@ -1,151 +1,139 @@
-using System;
-using System.Runtime.CompilerServices;
-using System.Threading;
-using System.Threading.Tasks;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
-namespace NetFabric.Hyperlinq
-{
- public readonly struct AsyncFunctionWrapper
- : IAsyncFunction
- {
- readonly Func> function;
-
- public AsyncFunctionWrapper(Func> function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public ValueTask InvokeAsync(T arg, CancellationToken cancellationToken)
- => function(arg, cancellationToken);
-
- public static implicit operator AsyncFunctionWrapper(Func> func)
- => new(func);
- }
-
- public readonly struct AsyncFunctionWrapper
- : IAsyncFunction
- {
- readonly Func> function;
-
- public AsyncFunctionWrapper(Func> function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public ValueTask InvokeAsync(T1 arg1, T2 arg2, CancellationToken cancellationToken)
- => function(arg1, arg2, cancellationToken);
-
- public static implicit operator AsyncFunctionWrapper(Func> func)
- => new(func);
- }
-
- public readonly struct AsyncFunctionWrapper
- : IAsyncFunction
- {
- readonly Func> function;
+namespace NetFabric.Hyperlinq;
- public AsyncFunctionWrapper(Func> function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
+[StructLayout(LayoutKind.Auto)]
+public readonly struct AsyncFunctionWrapper(Func> function)
+ : IAsyncFunction
+{
+ readonly Func> function
+ = function ?? throw new ArgumentNullException(nameof(function));
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public ValueTask InvokeAsync(T1 arg1, T2 arg2, T3 arg3, CancellationToken cancellationToken)
- => function(arg1, arg2, arg3, cancellationToken);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public ValueTask InvokeAsync(ref readonly T arg, CancellationToken cancellationToken)
+ => function(arg, cancellationToken);
- public static implicit operator AsyncFunctionWrapper(Func> func)
- => new(func);
- }
+ public static implicit operator AsyncFunctionWrapper(Func> func)
+ => new(func);
+}
- public readonly struct AsyncFunctionWrapper
- : IAsyncFunction
- {
- readonly Func> function;
+[StructLayout(LayoutKind.Auto)]
+public readonly struct AsyncFunctionWrapper(Func> function)
+ : IAsyncFunction
+{
+ readonly Func> function
+ = function ?? throw new ArgumentNullException(nameof(function));
- public AsyncFunctionWrapper(Func> function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public ValueTask InvokeAsync(ref readonly T1 arg1, ref readonly T2 arg2, CancellationToken cancellationToken)
+ => function(arg1, arg2, cancellationToken);
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public ValueTask InvokeAsync(T1 arg1, T2 arg2, T3 arg3, T4 arg4, CancellationToken cancellationToken)
- => function(arg1, arg2, arg3, arg4, cancellationToken);
+ public static implicit operator AsyncFunctionWrapper(Func> func)
+ => new(func);
+}
- public static implicit operator AsyncFunctionWrapper(Func> func)
- => new(func);
- }
+[StructLayout(LayoutKind.Auto)]
+public readonly struct AsyncFunctionWrapper(Func> function)
+ : IAsyncFunction
+{
+ readonly Func> function
+ = function ?? throw new ArgumentNullException(nameof(function));
- public readonly struct AsyncFunctionWrapper
- : IAsyncFunction
- {
- readonly Func> function;
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public ValueTask InvokeAsync(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, CancellationToken cancellationToken)
+ => function(arg1, arg2, arg3, cancellationToken);
- public AsyncFunctionWrapper(Func> function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
+ public static implicit operator AsyncFunctionWrapper(Func> func)
+ => new(func);
+}
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public ValueTask InvokeAsync(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, CancellationToken cancellationToken)
- => function(arg1, arg2, arg3, arg4, arg5, cancellationToken);
+[StructLayout(LayoutKind.Auto)]
+public readonly struct AsyncFunctionWrapper(Func> function)
+ : IAsyncFunction
+{
+ readonly Func> function
+ = function ?? throw new ArgumentNullException(nameof(function));
- public static implicit operator AsyncFunctionWrapper(Func> func)
- => new(func);
- }
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public ValueTask InvokeAsync(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, ref readonly T4 arg4, CancellationToken cancellationToken)
+ => function(arg1, arg2, arg3, arg4, cancellationToken);
- public readonly struct AsyncFunctionWrapper
- : IAsyncFunction
- {
- readonly Func> function;
+ public static implicit operator AsyncFunctionWrapper(Func> func)
+ => new(func);
+}
- public AsyncFunctionWrapper(Func> function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
+[StructLayout(LayoutKind.Auto)]
+public readonly struct AsyncFunctionWrapper(Func> function)
+ : IAsyncFunction
+{
+ readonly Func> function
+ = function ?? throw new ArgumentNullException(nameof(function));
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public ValueTask InvokeAsync(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, CancellationToken cancellationToken)
- => function(arg1, arg2, arg3, arg4, arg5, arg6, cancellationToken);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public ValueTask InvokeAsync(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, ref readonly T4 arg4, ref readonly T5 arg5, CancellationToken cancellationToken)
+ => function(arg1, arg2, arg3, arg4, arg5, cancellationToken);
- public static implicit operator AsyncFunctionWrapper(Func> func)
- => new(func);
- }
+ public static implicit operator AsyncFunctionWrapper(Func> func)
+ => new(func);
+}
- public readonly struct AsyncFunctionWrapper
- : IAsyncFunction
- {
- readonly Func> function;
+[StructLayout(LayoutKind.Auto)]
+public readonly struct AsyncFunctionWrapper(Func> function)
+ : IAsyncFunction
+{
+ readonly Func> function
+ = function ?? throw new ArgumentNullException(nameof(function));
- public AsyncFunctionWrapper(Func> function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public ValueTask InvokeAsync(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, ref readonly T4 arg4, ref readonly T5 arg5, ref readonly T6 arg6, CancellationToken cancellationToken)
+ => function(arg1, arg2, arg3, arg4, arg5, arg6, cancellationToken);
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public ValueTask InvokeAsync(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, CancellationToken cancellationToken)
- => function(arg1, arg2, arg3, arg4, arg5, arg6, arg7, cancellationToken);
+ public static implicit operator AsyncFunctionWrapper(Func> func)
+ => new(func);
+}
- public static implicit operator AsyncFunctionWrapper(Func> func)
- => new(func);
- }
+[StructLayout(LayoutKind.Auto)]
+public readonly struct AsyncFunctionWrapper(Func> function)
+ : IAsyncFunction
+{
+ readonly Func> function
+ = function ?? throw new ArgumentNullException(nameof(function));
- public readonly struct AsyncFunctionWrapper
- : IAsyncFunction
- {
- readonly Func> function;
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public ValueTask InvokeAsync(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, ref readonly T4 arg4, ref readonly T5 arg5, ref readonly T6 arg6, ref readonly T7 arg7, CancellationToken cancellationToken)
+ => function(arg1, arg2, arg3, arg4, arg5, arg6, arg7, cancellationToken);
- public AsyncFunctionWrapper(Func> function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
+ public static implicit operator AsyncFunctionWrapper(Func> func)
+ => new(func);
+}
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public ValueTask InvokeAsync(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, CancellationToken cancellationToken)
- => function(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, cancellationToken);
+[StructLayout(LayoutKind.Auto)]
+public readonly struct AsyncFunctionWrapper(Func> function)
+ : IAsyncFunction
+{
+ readonly Func> function
+ = function ?? throw new ArgumentNullException(nameof(function));
- public static implicit operator AsyncFunctionWrapper(Func> func)
- => new(func);
- }
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public ValueTask InvokeAsync(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, ref readonly T4 arg4, ref readonly T5 arg5, ref readonly T6 arg6, ref readonly T7 arg7, ref readonly T8 arg8, CancellationToken cancellationToken)
+ => function(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, cancellationToken);
- public readonly struct AsyncFunctionWrapper
- : IAsyncFunction
- {
- readonly Func> function;
+ public static implicit operator AsyncFunctionWrapper(Func> func)
+ => new(func);
+}
- public AsyncFunctionWrapper(Func> function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
+[StructLayout(LayoutKind.Auto)]
+public readonly struct AsyncFunctionWrapper(Func> function)
+ : IAsyncFunction
+{
+ readonly Func> function
+ = function ?? throw new ArgumentNullException(nameof(function));
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public ValueTask InvokeAsync(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, CancellationToken cancellationToken)
- => function(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, cancellationToken);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public ValueTask InvokeAsync(ref readonly T1 arg1, ref readonly T2 arg2, ref readonly T3 arg3, ref readonly T4 arg4, ref readonly T5 arg5, ref readonly T6 arg6, ref readonly T7 arg7, ref readonly T8 arg8, ref readonly T9 arg9, CancellationToken cancellationToken)
+ => function(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, cancellationToken);
- public static implicit operator AsyncFunctionWrapper(Func> func)
- => new(func);
- }
-}
+ public static implicit operator AsyncFunctionWrapper(Func> func)
+ => new(func);
+}
\ No newline at end of file
diff --git a/NetFabric.Hyperlinq.Abstractions/AsyncValueEnumerable.cs b/NetFabric.Hyperlinq.Abstractions/AsyncValueEnumerable.cs
index 528d61c1e..632693f18 100644
--- a/NetFabric.Hyperlinq.Abstractions/AsyncValueEnumerable.cs
+++ b/NetFabric.Hyperlinq.Abstractions/AsyncValueEnumerable.cs
@@ -1,12 +1,8 @@
-using System.Collections.Generic;
-using System.Threading;
+namespace NetFabric.Hyperlinq;
-namespace NetFabric.Hyperlinq
+public interface IAsyncValueEnumerable
+ : IAsyncEnumerable
+ where TEnumerator : struct, IAsyncEnumerator
{
- public interface IAsyncValueEnumerable
- : IAsyncEnumerable
- where TEnumerator : struct, IAsyncEnumerator
- {
- new TEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default);
- }
+ new TEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default);
}
\ No newline at end of file
diff --git a/NetFabric.Hyperlinq.Abstractions/FunctionIn.cs b/NetFabric.Hyperlinq.Abstractions/FunctionIn.cs
deleted file mode 100644
index b10e4d3c8..000000000
--- a/NetFabric.Hyperlinq.Abstractions/FunctionIn.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace NetFabric.Hyperlinq
-{
- public delegate TResult FunctionIn(in T arg);
-
- public delegate TResult FunctionIn(in T1 arg, T2 arg2);
-}
diff --git a/NetFabric.Hyperlinq.Abstractions/FunctionInWrapper.cs b/NetFabric.Hyperlinq.Abstractions/FunctionInWrapper.cs
deleted file mode 100644
index e91f77875..000000000
--- a/NetFabric.Hyperlinq.Abstractions/FunctionInWrapper.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using System.Runtime.CompilerServices;
-
-namespace NetFabric.Hyperlinq
-{
- public readonly struct FunctionInWrapper
- : IFunctionIn
- {
- readonly FunctionIn function;
-
- public FunctionInWrapper(FunctionIn function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public TResult Invoke(in T arg)
- => function(arg);
-
- public static implicit operator FunctionInWrapper(FunctionIn func)
- => new(func);
- }
-
- public readonly struct FunctionInWrapper
- : IFunctionIn
- {
- readonly FunctionIn function;
-
- public FunctionInWrapper(FunctionIn function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public TResult Invoke(in T1 arg1, T2 arg2)
- => function(arg1, arg2);
-
- public static implicit operator FunctionInWrapper(FunctionIn func)
- => new(func);
- }
-}
diff --git a/NetFabric.Hyperlinq.Abstractions/FunctionWrapper.cs b/NetFabric.Hyperlinq.Abstractions/FunctionWrapper.cs
index 7cd133f9f..2960455ba 100644
--- a/NetFabric.Hyperlinq.Abstractions/FunctionWrapper.cs
+++ b/NetFabric.Hyperlinq.Abstractions/FunctionWrapper.cs
@@ -1,165 +1,154 @@
-using System;
-using System.Runtime.CompilerServices;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
-namespace NetFabric.Hyperlinq
-{
- public readonly struct FunctionWrapper
- : IFunction
- {
- readonly Func function;
-
- public FunctionWrapper(Func function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public TResult Invoke()
- => function();
-
- public static implicit operator FunctionWrapper(Func func)
- => new(func);
- }
-
- public readonly struct FunctionWrapper
- : IFunction
- {
- readonly Func function;
-
- public FunctionWrapper(Func function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public TResult Invoke(T arg)
- => function(arg);
-
- public static implicit operator FunctionWrapper(Func func)
- => new(func);
- }
-
- public readonly struct FunctionWrapper
- : IFunction
- {
- readonly Func function;
+namespace NetFabric.Hyperlinq;
- public FunctionWrapper(Func function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
+[StructLayout(LayoutKind.Auto)]
+public readonly struct FunctionWrapper(Func function)
+ : IFunction
+{
+ readonly Func function
+ = function ?? throw new ArgumentNullException(nameof(function));
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public TResult Invoke(T1 arg1, T2 arg2)
- => function(arg1, arg2);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public TResult Invoke()
+ => function();
- public static implicit operator FunctionWrapper(Func func)
- => new(func);
- }
-
- public readonly struct FunctionWrapper
- : IFunction
- {
- readonly Func function;
+ public static implicit operator FunctionWrapper(Func func)
+ => new(func);
+}
- public FunctionWrapper(Func function)
- => this.function = function ?? throw new ArgumentNullException(nameof(function));
+[StructLayout(LayoutKind.Auto)]
+public readonly struct FunctionWrapper(Func function)
+ : IFunction
+{
+ readonly Func function
+ = function ?? throw new ArgumentNullException(nameof(function));
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public TResult Invoke(T1 arg1, T2 arg2, T3 arg3)
- => function(arg1, arg2, arg3);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public TResult Invoke(T arg)
+ => function(arg);
- public static implicit operator FunctionWrapper(Func func)
- => new(func);
- }
+ public static implicit operator FunctionWrapper(Func func)
+ => new(func);
+}
- public readonly struct FunctionWrapper