/// <summary>
        /// Reads a <see cref="IBufferReader{T}"/> to completion, writing to a <see cref="IBufferWriterAsync{T}"/>
        /// </summary>
        /// <typeparam name="T">The type of element</typeparam>
        /// <param name="reader">The reader to read from</param>
        /// <param name="writer">The writer to write to</param>
        /// <param name="token">A cancellation token to abort the operation</param>
        /// <returns>A task representing the progress fo the write operation</returns>
        public static async ValueTask CopyToAsync <T>(this IBufferReader <T> reader, IBufferWriterAsync <T> writer, CancellationToken token = default)
        {
            while (reader.CanRead)
            {
                var InBuffer = reader.GetMemory(0);

                if (InBuffer.IsEmpty)
                {
                    break;
                }

                InBuffer.Span.CopyTo(writer.GetSpan(InBuffer.Length));

                await writer.AdvanceAsync(InBuffer.Length, token);

                reader.Advance(InBuffer.Length);
            }
        }