MCPcopy
hub / github.com/andeya/pholcus / Bytes2String

Function Bytes2String

common/util/util.go:437–439  ·  view source on GitHub ↗

Bytes2String converts []byte to string via direct pointer conversion. Both share the same underlying memory; modifying one affects the other. Much faster than string([]byte{}) for large conversions.

(b []byte)

Source from the content-addressed store, hash-verified

435// Both share the same underlying memory; modifying one affects the other.
436// Much faster than string([]byte{}) for large conversions.
437func Bytes2String(b []byte) string {
438 return *(*string)(unsafe.Pointer(&b))
439}
440
441// String2Bytes converts string to []byte via direct pointer conversion.
442// Both share the same underlying memory; modifying one affects the other.

Callers 5

SerializeMethod · 0.92
setMethod · 0.92
GetTextMethod · 0.92
JSONStringFunction · 0.85

Calls

no outgoing calls

Tested by 1