MCPcopy
hub / github.com/pquerna/ffjson / DecodeFast

Method DecodeFast

ffjson/decoder.go:81–92  ·  view source on GitHub ↗

DecodeFast will unmarshal the data if fast unmarshal is available. This function can be used if you want to be sure the fast unmarshal is used or in testing. If you would like to have fallback to encoding/json you can use the regular Decode() method.

(data []byte, v interface{})

Source from the content-addressed store, hash-verified

79// If you would like to have fallback to encoding/json you can use the
80// regular Decode() method.
81func (d *Decoder) DecodeFast(data []byte, v interface{}) error {
82 f, ok := v.(unmarshalFaster)
83 if !ok {
84 return errors.New("ffjson unmarshal not available for type " + reflect.TypeOf(v).String())
85 }
86 if d.fs == nil {
87 d.fs = fflib.NewFFLexer(data)
88 } else {
89 d.fs.Reset(data)
90 }
91 return f.UnmarshalJSONFFLexer(d.fs, fflib.FFParse_map_start)
92}

Callers

nothing calls this directly

Calls 3

StringMethod · 0.65
ResetMethod · 0.65
UnmarshalJSONFFLexerMethod · 0.65

Tested by

no test coverage detected