aboutsummaryrefslogtreecommitdiff
path: root/fasthttpadaptor/b2s_new.go
blob: 6246e30eff54103af8a5e9d265eea67f6d178cbe (plain)
1
2
3
4
5
6
7
8
9
10
11
//go:build go1.20

package fasthttpadaptor

import "unsafe"

// b2s converts byte slice to a string without memory allocation.
// See https://groups.google.com/forum/#!msg/Golang-Nuts/ENgbUzYvCuU/90yGx7GUAgAJ .
func b2s(b []byte) string {
	return unsafe.String(unsafe.SliceData(b), len(b))
}