Commit c59e0f6
committed
feat(string): add Clone — detach string from backing memory
Adds core.Clone, the canonical wrapper for strings.Clone. Used when
a string aliases a reusable scratch buffer (e.g. via core.AsString
over a re-sliceable byte buffer) and the resulting string must
outlive the buffer's next reuse — map keys, struct fields, channel
sends across goroutines.
Driven by the gguf metadata loop in go-inference: the parser reads
keys into a reusable byte buffer and only stores the ~7 keys
ReadGGUFInfo queries. Without Clone, mapping a zero-copy view into
a map[string]any would risk later mutation aliasing the key.
Co-Authored-By: Virgil <virgil@lethean.io>1 parent ad23494 commit c59e0f6
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
43 | 53 | | |
44 | 54 | | |
45 | 55 | | |
| |||
0 commit comments