github.com/Azareal/Gosora@v0.0.0-20210729070923-553e66b59003/tmpl_client/stub.go (about)

     1  package tmpl
     2  
     3  import (
     4  	//"reflect"
     5  	//"runtime"
     6  	//"unsafe"
     7  	"github.com/Azareal/Gosora/uutils"
     8  )
     9  
    10  var GetFrag = func(name string) [][]byte {
    11  	return nil
    12  }
    13  
    14  type WriteString interface {
    15  	WriteString(s string) (n int, err error)
    16  }
    17  
    18  var StringToBytes = uutils.StringToBytes
    19  
    20  /*
    21  func StringToBytes(s string) (bytes []byte) {
    22  	str := (*reflect.StringHeader)(unsafe.Pointer(&s))
    23  	slice := (*reflect.SliceHeader)(unsafe.Pointer(&bytes))
    24  	slice.Data = str.Data
    25  	slice.Len = str.Len
    26  	slice.Cap = str.Len
    27  	runtime.KeepAlive(&s)
    28  	return bytes
    29  }
    30  */