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)
| 14 | // |
| 15 | // The function panics if v cannot be converted to a thrift representation. |
| 16 | func 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 | |
| 23 | type Encoder struct { |
| 24 | w Writer |
searching dependent graphs…