def Cursor.write.if

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

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

909def Cursor.write.if(~T: Data, ~write: Bytes -> @+i:U32 -> @+v:T -> Bytes, ok: Bool, c: Cursor, +n: U32, v: T) -> Cursor & Bool:
910  match ok:
911    case False{}:
912      (c, False{})
913    case True{}:
914      Cursor{b, +pos, start, end} = c
915      (Cursor{write(b, pos, v), (pos + n : U32), start, end}, True{})

Uses (7)

Used by (1)