Google.Protobuf.WriteBufferHelper
struct WriteBufferHelper
Abstraction for writing to a steam / IBufferWriter
Verifies that SpaceLeft returns zero.
If writing to a flat array, returns the space left in the array. Otherwise,
throws an InvalidOperationException.
Initialize an instance with a coded output stream.
This approach is faster than using a constructor because the instance to initialize is passed by reference
and we can write directly into it without copying.
public static void Initialize(IBufferWriter<byte> bufferWriter, out WriteBufferHelper instance, out Span buffer)
Initialize an instance with a buffer writer.
This approach is faster than using a constructor because the instance to initialize is passed by reference
and we can write directly into it without copying.
Initialize an instance with a buffer represented by a single span (i.e. buffer cannot be refreshed)
This approach is faster than using a constructor because the instance to initialize is passed by reference
and we can write directly into it without copying.