DotNext by Roman Sakno

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

 IReadOnlySpanConsumer<T>

Represents functional interface returning no value and accepting the single argument of type ReadOnlySpan<T>.
using DotNext.Runtime.CompilerServices; using System; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; namespace DotNext.Buffers { [System.Runtime.CompilerServices.NullableContext(2)] [FunctionalInterface] public interface IReadOnlySpanConsumer<T> : ISupplier<ReadOnlyMemory<T>, CancellationToken, ValueTask> { void Invoke([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] ReadOnlySpan<T> span); ValueTask ISupplier<ReadOnlyMemory<T>, CancellationToken, ValueTask>.Invoke([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] ReadOnlyMemory<T> input, CancellationToken token) { if (!token.IsCancellationRequested) { ValueTask result = default(ValueTask); try { Invoke(input.Span); return result; } catch (Exception exception) { return new ValueTask(Task.FromException(exception)); } } return new ValueTask(Task.FromCanceled(token)); } } }