1
0
mirror of https://github.com/fumiama/tienyik.git synced 2026-06-28 15:00:23 +08:00

feat: add log & supporting packages

This commit is contained in:
源文雨
2025-10-30 23:23:45 +08:00
parent 617fc662c5
commit 15fcc9a338
19 changed files with 672 additions and 12 deletions

13
internal/textio/str.go Normal file
View File

@@ -0,0 +1,13 @@
package textio
import "unsafe"
// BytesToString 没有内存开销的转换
func BytesToString(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}
// StringToBytes 没有内存开销的转换
func StringToBytes(s string) (b []byte) {
return unsafe.Slice(unsafe.StringData(s), len(s))
}