<PackageReference Include="Google.Protobuf" Version="3.35.0-rc1" />

Google.Protobuf.SegmentedBufferHelper

Abstraction for reading from a stream / read only sequence. Parsing from the buffer is a loop of reading from current buffer / refreshing the buffer once done.
namespace Google.Protobuf { internal struct SegmentedBufferHelper { public int? TotalLength { get; } public CodedInputStream CodedInputStream { get; } public static void Initialize(CodedInputStream codedInputStream, out SegmentedBufferHelper instance); public static void Initialize(ReadOnlySequence<byte> sequence, out SegmentedBufferHelper instance, out ReadOnlySpan<byte> firstSpan); public bool RefillBuffer(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state, bool mustSucceed); public static int PushLimit(ref ParserInternalState state, int byteLimit); public static void PopLimit(ref ParserInternalState state, int oldLimit); public static bool IsReachedLimit(ref ParserInternalState state); public static bool IsAtEnd(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state); } }