s2b.go 186 B

12345678
  1. package fasthttputil
  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. }