def bytes.clone

mylsm-lsm-store@0.6.0.1 · src/ByteMemTable.bend:98

import mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend as ByteMemTable
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

98# Duplicates a byte buffer only when ownership must be retained by the table.
99def bytes.clone(bytes: Bytes.Bytes) -> Bytes.Bytes & Bytes.Bytes:
100  match bytes:
101    case Bytes.Bytes{+len, buf}:
102      bytes.clone.pair(len, Bytes.copy.bytes(len, buf, Bytes.alloc(len), 0, 0))

Uses (5)

Used by (54)