MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / FromJsonGen

Function FromJsonGen

pkg/waveobj/waveobj.go:317–329  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

315}
316
317func FromJsonGen[T WaveObj](data []byte) (T, error) {
318 obj, err := FromJson(data)
319 if err != nil {
320 var zero T
321 return zero, err
322 }
323 rtn, ok := obj.(T)
324 if !ok {
325 var zero T
326 return zero, fmt.Errorf("type mismatch got %T, expected %T", obj, zero)
327 }
328 return rtn, nil
329}

Callers

nothing calls this directly

Calls 1

FromJsonFunction · 0.85

Tested by

no test coverage detected