MCPcopy Index your code
hub / github.com/segmentio/encoding / decodeBool

Method decodeBool

json/decode.go:31–47  ·  view source on GitHub ↗
(b []byte, p unsafe.Pointer)

Source from the content-addressed store, hash-verified

29}
30
31func (d decoder) decodeBool(b []byte, p unsafe.Pointer) ([]byte, error) {
32 switch {
33 case hasTruePrefix(b):
34 *(*bool)(p) = true
35 return b[4:], nil
36
37 case hasFalsePrefix(b):
38 *(*bool)(p) = false
39 return b[5:], nil
40
41 case hasNullPrefix(b):
42 return b[4:], nil
43
44 default:
45 return d.inputError(b, boolType)
46 }
47}
48
49func (d decoder) decodeInt(b []byte, p unsafe.Pointer) ([]byte, error) {
50 if hasNullPrefix(b) {

Callers 1

decodeMapStringBoolMethod · 0.95

Calls 4

inputErrorMethod · 0.95
hasTruePrefixFunction · 0.85
hasFalsePrefixFunction · 0.85
hasNullPrefixFunction · 0.85

Tested by

no test coverage detected