s2b.go 182 B

12345678
  1. package fasthttp
  2. import "unsafe"
  3. // s2b converts string to a byte slice without memory allocation.
  4. func s2b(s string) []byte {
  5. return unsafe.Slice(unsafe.StringData(s), len(s))
  6. }