well-goknown/vendor/github.com/valyala/fasthttp/s2b_new.go

11 lines
201 B
Go
Raw Permalink Normal View History

//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))
}