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

Method NextType

msgp/read.go:297–321  ·  view source on GitHub ↗

NextType returns the next object type to be decoded.

()

Source from the content-addressed store, hash-verified

295
296// NextType returns the next object type to be decoded.
297func (m *Reader) NextType() (Type, error) {
298 next, err := m.R.PeekByte()
299 if err != nil {
300 return InvalidType, err
301 }
302 t := getType(next)
303 if t == InvalidType {
304 return t, InvalidPrefixError(next)
305 }
306 if t == ExtensionType {
307 v, err := m.peekExtensionType()
308 if err != nil {
309 return InvalidType, err
310 }
311 switch v {
312 case Complex64Extension:
313 return Complex64Type, nil
314 case Complex128Extension:
315 return Complex128Type, nil
316 case TimeExtension, MsgTimeExtension:
317 return TimeType, nil
318 }
319 }
320 return t, nil
321}
322
323// IsNil returns whether or not
324// the next byte is a null messagepack byte

Callers 7

TestSkipFunction · 0.95
FuzzReaderFunction · 0.95
ReadJSONNumberMethod · 0.95
ReadIntfMethod · 0.95
DecodeMsgMethod · 0.80
rwNextFunction · 0.80
rwMapFunction · 0.80

Calls 3

peekExtensionTypeMethod · 0.95
getTypeFunction · 0.85
InvalidPrefixErrorTypeAlias · 0.85

Tested by 2

TestSkipFunction · 0.76
FuzzReaderFunction · 0.76