MCPcopy Create free account
hub / github.com/segmentio/encoding / Marshal

Function Marshal

thrift/encode.go:16–21  ·  view source on GitHub ↗

Marshal serializes v into a thrift representation according to the the protocol p. The function panics if v cannot be converted to a thrift representation.

(p Protocol, v any)

Source from the content-addressed store, hash-verified

14//
15// The function panics if v cannot be converted to a thrift representation.
16func Marshal(p Protocol, v any) ([]byte, error) {
17 buf := new(bytes.Buffer)
18 enc := NewEncoder(p.NewWriter(buf))
19 err := enc.Encode(v)
20 return buf.Bytes(), err
21}
22
23type Encoder struct {
24 w Writer

Callers 2

testMarshalUnmarshalFunction · 0.92
benchmarkUnmarshalFunction · 0.92

Calls 4

EncodeMethod · 0.95
BytesMethod · 0.80
NewEncoderFunction · 0.70
NewWriterMethod · 0.65

Tested by 2

testMarshalUnmarshalFunction · 0.74
benchmarkUnmarshalFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…