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

Function ReadNilBytes

msgp/read_bytes.go:316–324  ·  view source on GitHub ↗

ReadNilBytes tries to read a "nil" byte off of 'b' and return the remaining bytes. Possible errors: - [ErrShortBytes] (too few bytes) - [TypeError] (not a 'nil') - [InvalidPrefixError]

(b []byte)

Source from the content-addressed store, hash-verified

314// - [TypeError] (not a 'nil')
315// - [InvalidPrefixError]
316func ReadNilBytes(b []byte) ([]byte, error) {
317 if len(b) < 1 {
318 return nil, ErrShortBytes
319 }
320 if b[0] != mnil {
321 return b, badPrefix(NilType, b[0])
322 }
323 return b[1:], nil
324}
325
326// ReadFloat64Bytes tries to read a float64
327// from 'b' and return the value and the remaining bytes.

Callers 9

UnmarshalMsgMethod · 0.92
UnmarshalMsgMethod · 0.92
TestReadNilBytesFunction · 0.85
BenchmarkReadNilByteFunction · 0.85
FuzzReadBytesFunction · 0.85
rwNullBytesFunction · 0.85
ReadArrayBytesFunction · 0.85
ReadMapBytesFunction · 0.85
readIntfBytesDepthFunction · 0.85

Calls 1

badPrefixFunction · 0.85

Tested by 3

TestReadNilBytesFunction · 0.68
BenchmarkReadNilByteFunction · 0.68
FuzzReadBytesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…