mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 15:47:21 +00:00
rlp: add AppendRaw method to RawList (#33834)
This is helpful when building a list from already-encoded elements.
This commit is contained in:
parent
f2869793df
commit
ece2b19ac0
1 changed files with 8 additions and 0 deletions
|
|
@ -145,6 +145,14 @@ func (r *RawList[T]) Append(item T) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AppendRaw adds an encoded item to the list.
|
||||||
|
func (r *RawList[T]) AppendRaw(b []byte) {
|
||||||
|
if r.enc == nil {
|
||||||
|
r.enc = make([]byte, 9)
|
||||||
|
}
|
||||||
|
r.enc = append(r.enc, b...)
|
||||||
|
}
|
||||||
|
|
||||||
// StringSize returns the encoded size of a string.
|
// StringSize returns the encoded size of a string.
|
||||||
func StringSize(s string) uint64 {
|
func StringSize(s string) uint64 {
|
||||||
switch n := len(s); n {
|
switch n := len(s); n {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue