55///////////////////////////////////////////////////////
66
77using System ;
8+ using System . Diagnostics ;
89using System . Runtime . CompilerServices ;
910
1011[ DebuggerDisplay ( "Capacity = {Capacity}, Length = {Length}, IsPooled = {IsPooled}" ) ]
@@ -318,7 +319,7 @@ public BytePayloadReader(BytePayload owner, int offset)
318319 /// <returns>Whether or not a byte is available to peek</returns>
319320
320321 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
321- public bool TryPeekByte ( out byte value )
322+ public readonly bool TryPeekByte ( out byte value )
322323 {
323324 if ( _owner . IsDestroyed || ! HasRemaining )
324325 {
@@ -339,7 +340,7 @@ public bool TryPeekByte(out byte value)
339340 /// <returns>Whether or not a byte is available to peek</returns>
340341
341342 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
342- public bool TryPeek ( out byte value ) =>
343+ public readonly bool TryPeek ( out byte value ) =>
343344 TryPeekByte ( out value ) ;
344345
345346 /// <summary>
@@ -351,7 +352,7 @@ public bool TryPeek(out byte value) =>
351352 /// <returns>Whether or not the specified number of bytes could be peeked</returns>
352353
353354 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
354- public bool TryPeekBytes ( int count , out ReadOnlySpan < byte > data )
355+ public readonly bool TryPeekBytes ( int count , out ReadOnlySpan < byte > data )
355356 {
356357 if ( _owner . IsDestroyed || Position + count > _owner . Length )
357358 {
@@ -373,16 +374,16 @@ public bool TryPeekBytes(int count, out ReadOnlySpan<byte> data)
373374 /// <returns>Whether or not the specified number of bytes could be peeked</returns>
374375
375376 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
376- public bool TryPeek ( int count , out ReadOnlySpan < byte > data ) =>
377- TryPeekByte ( count , out data ) ;
377+ public readonly bool TryPeek ( int count , out ReadOnlySpan < byte > data ) =>
378+ TryPeekBytes ( count , out data ) ;
378379
379380 /// <summary>
380381 /// Peeks the byte at the current position
381382 /// </summary>
382383 /// <returns>The byte peeked</returns>
383384
384385 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
385- public byte PeekByte ( )
386+ public readonly byte PeekByte ( )
386387 {
387388#if DEBUG
388389 if ( _owner . IsDestroyed )
@@ -401,7 +402,7 @@ public byte PeekByte()
401402 /// <returns>The byte peeked</returns>
402403
403404 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
404- public byte Peek ( ) =>
405+ public readonly byte Peek ( ) =>
405406 PeekByte ( ) ;
406407
407408 /// <summary>
@@ -410,7 +411,7 @@ public byte Peek() =>
410411 /// <returns>The bytes peeked</returns>
411412
412413 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
413- public ReadOnlySpan < byte > PeekBytes ( int count )
414+ public readonly ReadOnlySpan < byte > PeekBytes ( int count )
414415 {
415416#if DEBUG
416417 if ( _owner . IsDestroyed )
@@ -428,7 +429,7 @@ public ReadOnlySpan<byte> PeekBytes(int count)
428429 /// <returns>The bytes peeked</returns>
429430
430431 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
431- public ReadOnlySpan < byte > Peek ( int count ) =>
432+ public readonly ReadOnlySpan < byte > Peek ( int count ) =>
432433 PeekBytes ( count ) ;
433434
434435 /// <summary>
@@ -494,7 +495,7 @@ public byte ReadByte()
494495
495496 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
496497 public byte Read ( ) =>
497- ReadBytes ( ) ;
498+ ReadByte ( ) ;
498499
499500 /// <summary>
500501 /// Reads the specified number of bytes at the current position<br/>
0 commit comments