Updates Pipe & Makes NetState more testable (#288)

Updates pipe eliminate result and segments from being allocated.

Bumps release version
This commit is contained in:
Kamron Batman 2020-10-25 17:40:08 -07:00 • committed by GitHub
parent 293e691539
commit 990e6fe188
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 219 additions and 198 deletions

View file

@ -15,7 +15,7 @@
namespace System.Buffers
{
public readonly ref struct CircularBuffer<T> where T : struct
public readonly ref struct CircularBuffer<T>
{
private readonly Span<T> _first;
private readonly Span<T> _second;
@ -126,5 +126,15 @@ namespace System.Buffers
return new CircularBuffer<T>(first, second);
}
public Span<T> GetSpan(int index)
{
if (index < 0 || index > 1)
{
throw new ArgumentOutOfRangeException(nameof(index));
}
return index == 0 ? _first : _second;
}
}
}