def slice

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

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

341# The buffer back, and a copy of up to n bytes from start. Both ends are clamped to len.
342def slice(b: Bytes, +start: U32, +n: U32) -> Bytes & Bytes:
343  Bytes{+len, buf} = b
344  +s = U32.min(start, len)
345  slice.at(len, buf, s, U32.min(n, (len - s : U32)))

Uses (6)

Used by (77)