github.com/webmafia/fast@v0.10.0/string.go (about)

     1  package fast
     2  
     3  import "unsafe"
     4  
     5  //go:inline
     6  func StringToBytes(s string) []byte {
     7  	return unsafe.Slice(unsafe.StringData(s), len(s))
     8  }
     9  
    10  //go:inline
    11  func BytesToString(b []byte) string {
    12  	return unsafe.String(unsafe.SliceData(b), len(b))
    13  }