Use in for ReadOnlySequence (#1900)

This commit is contained in:
David Fowler 2018-04-09 09:29:27 -07:00 committed by GitHub
parent 962ea25637
commit 01089da84d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View File

@ -25,7 +25,7 @@ namespace ClientSample
_eventArgs.Completed += (_, e) => ((SocketAwaitable)e.UserToken).Complete(e.BytesTransferred, e.SocketError); _eventArgs.Completed += (_, e) => ((SocketAwaitable)e.UserToken).Complete(e.BytesTransferred, e.SocketError);
} }
public SocketAwaitable SendAsync(ReadOnlySequence<byte> buffers) public SocketAwaitable SendAsync(in ReadOnlySequence<byte> buffers)
{ {
if (buffers.IsSingleSegment) if (buffers.IsSingleSegment)
{ {
@ -74,7 +74,7 @@ namespace ClientSample
return _awaitable; return _awaitable;
} }
private List<ArraySegment<byte>> GetBufferList(ReadOnlySequence<byte> buffer) private List<ArraySegment<byte>> GetBufferList(in ReadOnlySequence<byte> buffer)
{ {
Debug.Assert(!buffer.IsEmpty); Debug.Assert(!buffer.IsEmpty);
Debug.Assert(!buffer.IsSingleSegment); Debug.Assert(!buffer.IsSingleSegment);

View File

@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Client.Internal
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
private ReadOnlySpan<byte> ConvertBufferToSpan(ReadOnlySequence<byte> buffer) private ReadOnlySpan<byte> ConvertBufferToSpan(in ReadOnlySequence<byte> buffer)
{ {
if (buffer.IsSingleSegment) if (buffer.IsSingleSegment)
{ {

View File

@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Client
{ {
private readonly ReadOnlySequence<byte> _buffer; private readonly ReadOnlySequence<byte> _buffer;
public ReadOnlySequenceContent(ReadOnlySequence<byte> buffer) public ReadOnlySequenceContent(in ReadOnlySequence<byte> buffer)
{ {
_buffer = buffer; _buffer = buffer;
} }

View File

@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal
private const byte LineFeed = (byte)'\n'; private const byte LineFeed = (byte)'\n';
public static async Task WriteMessageAsync(ReadOnlySequence<byte> payload, Stream output) public static Task WriteMessageAsync(in ReadOnlySequence<byte> payload, Stream output)
{ {
var ms = new MemoryStream(); var ms = new MemoryStream();
@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal
ms.Position = 0; ms.Position = 0;
await ms.CopyToAsync(output); return ms.CopyToAsync(output);
} }
public static void WriteMessage(ReadOnlyMemory<byte> payload, Stream output) public static void WriteMessage(ReadOnlyMemory<byte> payload, Stream output)

View File

@ -63,7 +63,7 @@ namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
return message != null; return message != null;
} }
private static ArraySegment<byte> GetArraySegment(ReadOnlySequence<byte> input) private static ArraySegment<byte> GetArraySegment(in ReadOnlySequence<byte> input)
{ {
if (input.IsSingleSegment) if (input.IsSingleSegment)
{ {