MCPcopy Index your code
hub / github.com/yuin/gopher-lua / unsafeFastStringToReadOnlyBytes

Function unsafeFastStringToReadOnlyBytes

utils.go:258–265  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

256}
257
258func unsafeFastStringToReadOnlyBytes(s string) (bs []byte) {
259 sh := (*reflect.StringHeader)(unsafe.Pointer(&s))
260 bh := (*reflect.SliceHeader)(unsafe.Pointer(&bs))
261 bh.Data = sh.Data
262 bh.Cap = sh.Len
263 bh.Len = sh.Len
264 return
265}

Callers 4

fileWriteAuxFunction · 0.85
strFindFunction · 0.85
strGsubFunction · 0.85
strMatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…