def append

bend-kit-bytes@0.3.3.0 · bytes.bend:375

import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import Base

375# a then b. b is written into a's buffer while it has room, and the buffer at least
376# doubles when it runs out, so building a buffer one piece at a time is O(total).
377def append(a: Bytes, b: Bytes) -> Bytes:
378  Bytes{+la, ba} = a
379  Bytes{+lb, bb} = b
380  +n = (la + lb : U32)
381  Bytes{n, dst(copy(lb, bb, grow(la, ba, n), 0, la))}

Uses (6)

Used by (50)