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

Method decodeFromString

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

Source from the content-addressed store, hash-verified

304}
305
306func (d decoder) decodeFromString(b []byte, p unsafe.Pointer, decode decodeFunc) ([]byte, error) {
307 if hasNullPrefix(b) {
308 return decode(d, b, p)
309 }
310
311 v, b, _, err := d.parseStringUnquote(b, nil)
312 if err != nil {
313 return d.inputError(v, stringType)
314 }
315
316 if v, err = decode(d, v, p); err != nil {
317 return b, err
318 }
319
320 if v = skipSpaces(v); len(v) != 0 {
321 return b, syntaxError(v, "unexpected trailing tokens after string value")
322 }
323
324 return b, nil
325}
326
327func (d decoder) decodeFromStringToInt(b []byte, p unsafe.Pointer, t reflect.Type, decode decodeFunc) ([]byte, error) {
328 if hasNullPrefix(b) {

Callers 1

Calls 5

parseStringUnquoteMethod · 0.95
inputErrorMethod · 0.95
hasNullPrefixFunction · 0.85
skipSpacesFunction · 0.85
syntaxErrorFunction · 0.85

Tested by

no test coverage detected