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

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