MCPcopy
hub / github.com/tinylib/msgp / WriteArrayHeader

Method WriteArrayHeader

msgp/write.go:337–346  ·  view source on GitHub ↗

WriteArrayHeader writes an array header of the given size to the writer

(sz uint32)

Source from the content-addressed store, hash-verified

335// WriteArrayHeader writes an array header of the
336// given size to the writer
337func (mw *Writer) WriteArrayHeader(sz uint32) error {
338 switch {
339 case sz <= 15:
340 return mw.push(wfixarray(uint8(sz)))
341 case sz <= math.MaxUint16:
342 return mw.prefix16(marray16, uint16(sz))
343 default:
344 return mw.prefix32(marray32, sz)
345 }
346}
347
348// WriteNil writes a nil byte to the buffer
349func (mw *Writer) WriteNil() error {

Callers 15

TestReadArrayHeaderBytesFunction · 0.95
TestReadIntfRecursionFunction · 0.95
TestSkipRecursionFunction · 0.95
TestReadArrayHeaderFunction · 0.95
TestWriteArrayHeaderFunction · 0.95
BenchmarkCopyToJSONFunction · 0.95
TestReadNumberArray_IntFunction · 0.95
TestReadArray_StringFunction · 0.95
TestReadArray_BoolFunction · 0.95
TestReadArray_DecodableFunction · 0.95

Calls 4

pushMethod · 0.95
prefix16Method · 0.95
prefix32Method · 0.95
wfixarrayFunction · 0.85

Tested by 15

TestReadArrayHeaderBytesFunction · 0.76
TestReadIntfRecursionFunction · 0.76
TestSkipRecursionFunction · 0.76
TestReadArrayHeaderFunction · 0.76
TestWriteArrayHeaderFunction · 0.76
BenchmarkCopyToJSONFunction · 0.76
TestReadNumberArray_IntFunction · 0.76
TestReadArray_StringFunction · 0.76
TestReadArray_BoolFunction · 0.76
TestReadArray_DecodableFunction · 0.76