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

Function MarshalFast

ffjson/marshal.go:69–75  ·  view source on GitHub ↗

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

(v interface{})

Source from the content-addressed store, hash-verified

67// If you would like to have fallback to encoding/json you can use the
68// Marshal() method.
69func MarshalFast(v interface{}) ([]byte, error) {
70 _, ok := v.(marshalerFaster)
71 if !ok {
72 return nil, errors.New("ffjson marshal not available for type " + reflect.TypeOf(v).String())
73 }
74 return Marshal(v)
75}
76
77// Unmarshal will act the same way as json.Unmarshal, except
78// it will choose the ffjson unmarshal function before falling

Callers

nothing calls this directly

Calls 2

MarshalFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…