MCPcopy
hub / github.com/gin-gonic/gin / BytesToString

Function BytesToString

internal/bytesconv/bytesconv.go:19–21  ·  view source on GitHub ↗

BytesToString converts byte slice to string without a memory allocation. For more details, see https://github.com/golang/go/issues/53003#issuecomment-1140276077.

(b []byte)

Source from the content-addressed store, hash-verified

17// BytesToString converts byte slice to string without a memory allocation.
18// For more details, see https://github.com/golang/go/issues/53003#issuecomment-1140276077.
19func BytesToString(b []byte) string {
20 return unsafe.String(unsafe.SliceData(b), len(b))
21}

Callers 8

secureRequestDumpFunction · 0.92
addRouteMethod · 0.92
redirectFixedPathFunction · 0.92
RenderMethod · 0.92
decodePlainFunction · 0.92
TestBytesToStringFunction · 0.85
TestBytesToStringEmptyFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by 3

TestBytesToStringFunction · 0.68
TestBytesToStringEmptyFunction · 0.68