github.com/bibaroc/wingman@v0.0.2-0.20200911182922-33c2085136b1/pkg/fst/string.go (about) 1 package fst 2 3 import ( 4 "unsafe" 5 _ "unsafe" 6 ) 7 8 //go:linkname String runtime.gostringnocopy 9 func String(b *byte) string 10 11 func Str(str *byte, ln int) string { 12 ss := stringStruct{str: unsafe.Pointer(str), len: ln} 13 s := *(*string)(unsafe.Pointer(&ss)) 14 return s 15 } 16 17 type stringStruct struct { 18 str unsafe.Pointer 19 len int 20 }