gitlab.com/evatix-go/core@v1.3.55/converters/UnsafeBytesToStrings.go (about)

     1  package converters
     2  
     3  import (
     4  	"unsafe"
     5  )
     6  
     7  // UnsafeBytesToStrings
     8  //
     9  // Returns string arrays from unsafe bytes pointer
    10  //
    11  // May panic on conversion if the bytes were not in unsafe pointer.
    12  //
    13  // Expressions:
    14  // - return (*[] string)(unsafe.Pointer(allBytes))
    15  func UnsafeBytesToStrings(unsafeBytes *[]byte) *[]string {
    16  	if unsafeBytes == nil || *unsafeBytes == nil {
    17  		return nil
    18  	}
    19  
    20  	return (*[]string)(unsafe.Pointer(unsafeBytes))
    21  }