aboutsummaryrefslogtreecommitdiff
path: root/s2b_new.go
blob: aedc448e718213129b9284d1d9fb168951018732 (plain)
1
2
3
4
5
6
7
8
9
10
//go:build go1.20

package fasthttp

import "unsafe"

// s2b converts string to a byte slice without memory allocation.
func s2b(s string) []byte {
	return unsafe.Slice(unsafe.StringData(s), len(s))
}