def field.sized.inputs

mylsm-lsm-store@0.6.0.1 · src/coordinator/CursorOpenCodec.bend:103

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

103# Separates validation inputs from the values passed to the slice decision.
104def field.sized.inputs(
105  payload: Bytes.Bytes,
106  totals: U32 & U32,
107  offsets: U32 & U32,
108  lengths: U32 & U32
109) -> BoundResult:
110  match totals:
111    case (_, check_total):
112      match offsets:
113        case (slice_offset, check_offset):
114          match lengths:
115            case (slice_length, check_length):
116              field.sized.decision(payload, slice_offset, slice_length,
117                Nat.is_le(Nat.add(Nat.add(U32.to_nat(check_offset), 4n),
118                  U32.to_nat(check_length)), U32.to_nat(check_total)))

Uses (9)

Used by (1)