erigon-pulse/turbo/trie/utils.go
2021-03-29 10:58:45 +07:00

18 lines
290 B
Go

package trie
type ByteArrayWriter struct {
dest []byte
pos int
}
func (w *ByteArrayWriter) Setup(dest []byte, pos int) {
w.dest = dest
w.pos = pos
}
func (w *ByteArrayWriter) Write(data []byte) (int, error) {
copy(w.dest[w.pos:], data)
w.pos += len(data)
return len(data), nil
}