MCPcopy Create free account
hub / github.com/chain/Core / CopyBytes

Function CopyBytes

encoding/bufpool/bufpool.go:30–35  ·  view source on GitHub ↗

CopyBytes returns a copy of the bytes contained in the buffer. This slice is safe from updates in the underlying buffer, allowing the buffer to be placed back in the free list.

(buf *bytes.Buffer)

Source from the content-addressed store, hash-verified

28// This slice is safe from updates in the underlying buffer,
29// allowing the buffer to be placed back in the free list.
30func CopyBytes(buf *bytes.Buffer) []byte {
31 b := buf.Bytes()
32 b2 := make([]byte, len(b))
33 copy(b2, b)
34 return b2
35}

Callers

nothing calls this directly

Calls 1

BytesMethod · 0.45

Tested by

no test coverage detected