MCPcopy Create free account
hub / github.com/facebook/time / BytesTo

Function BytesTo

ptp/protocol/protocol.go:508–517  ·  view source on GitHub ↗

BytesTo marshalls packets that support this optimized marshalling into []byte

(p BinaryMarshalerTo, buf []byte)

Source from the content-addressed store, hash-verified

506
507// BinaryMarshalerTo is an interface implemented by an object that can marshal itself into a binary form into provided []byte
508type BinaryMarshalerTo interface {
509 MarshalBinaryTo([]byte) (int, error)
510}
511
512// BytesTo marshalls packets that support this optimized marshalling into []byte
513func 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

Callers 5

TestBytesToFunction · 0.85
BenchmarkWriteSyncFunction · 0.85
BenchmarkWriteAnnounceFunction · 0.85
BenchmarkWriteFollowupFunction · 0.85
BenchmarkWriteSignalingFunction · 0.85

Calls 1

MarshalBinaryToMethod · 0.65

Tested by 5

TestBytesToFunction · 0.68
BenchmarkWriteSyncFunction · 0.68
BenchmarkWriteAnnounceFunction · 0.68
BenchmarkWriteFollowupFunction · 0.68
BenchmarkWriteSignalingFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…