github.com/gofiber/fiber/v2@v2.47.0/utils/convert_s2b_new.go (about)

     1  //go:build go1.20
     2  // +build go1.20
     3  
     4  package utils
     5  
     6  import (
     7  	"unsafe"
     8  )
     9  
    10  // UnsafeBytes returns a byte pointer without allocation.
    11  func UnsafeBytes(s string) []byte {
    12  	return unsafe.Slice(unsafe.StringData(s), len(s))
    13  }