BytesTo marshalls packets that support this optimized marshalling into []byte
(p BinaryMarshalerTo, buf []byte)
| 506 | |
| 507 | // BinaryMarshalerTo is an interface implemented by an object that can marshal itself into a binary form into provided []byte |
| 508 | type BinaryMarshalerTo interface { |
| 509 | MarshalBinaryTo([]byte) (int, error) |
| 510 | } |
| 511 | |
| 512 | // BytesTo marshalls packets that support this optimized marshalling into []byte |
| 513 | func BytesTo(p BinaryMarshalerTo, buf []byte) (int, error) { |
| 514 | n, err := p.MarshalBinaryTo(buf) |
| 515 | if err != nil { |
| 516 | return 0, err |
| 517 | } |
| 518 | // add two zero bytes |
| 519 | buf[n] = 0x0 |
| 520 | buf[n+1] = 0x0 |
searching dependent graphs…