def trim

bend-kit-llm@0.13.0.1 · sse.bend:164

import bend-kit-llm@0.13.0.1/sse.bend as Sse
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

164# Drops the last LF. Bytes past len stay 0.
165def trim(b: Bytes.Bytes) -> Bytes.Bytes:
166  Bytes.Bytes{+n, buf} = b
167  Bytes.Bytes{(n - 1 : U32), Bytes.poke(buf, (n - 1 : U32), 0)}

Uses (4)

Used by (1)