MCPcopy Index your code
hub / github.com/flike/kingshard / String

Function String

core/hack/hack.go:26–32  ·  view source on GitHub ↗

no copy to change slice to string use your own risk

(b []byte)

Source from the content-addressed store, hash-verified

24// no copy to change slice to string
25// use your own risk
26func String(b []byte) (s string) {
27 pbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b))
28 pstring := (*reflect.StringHeader)(unsafe.Pointer(&s))
29 pstring.Data = pbytes.Data
30 pstring.Len = pbytes.Len
31 return
32}
33
34// no copy to change string to slice
35// use your own risk

Callers 1

TestStringFunction · 0.70

Calls

no outgoing calls

Tested by 1

TestStringFunction · 0.56