DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.7.1" />

 ReadOnlySpanConsumer<T, TArg>

Represents typed function pointer implementing IReadOnlySpanConsumer<T>.
using DotNext.Runtime.CompilerServices; using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; namespace DotNext.Buffers { [StructLayout(LayoutKind.Auto)] [System.Runtime.CompilerServices.NullableContext(2)] [System.Runtime.CompilerServices.Nullable(0)] [CLSCompliant(false)] public readonly struct ReadOnlySpanConsumer<T, TArg> : IReadOnlySpanConsumer<T>, ISupplier<ReadOnlyMemory<T>, CancellationToken, ValueTask>, IFunctional<Func<ReadOnlyMemory<T>, CancellationToken, ValueTask>> { private readonly IntPtr ptr; private readonly TArg arg; public unsafe bool IsEmpty => ptr == (IntPtr)(void*)null; [System.Runtime.CompilerServices.NullableContext(1)] public unsafe ReadOnlySpanConsumer([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 0, 1, 1 })] IntPtr ptr, TArg arg) { if (ptr == (IntPtr)(void*)null) throw new ArgumentNullException("ptr"); this.ptr = ptr; this.arg = arg; } void IReadOnlySpanConsumer<T>.Invoke(ReadOnlySpan<T> span) { IntPtr intPtr = ptr; ; } } }