def len_err

bend-schema-lib@0.4.1.0 · core.bend:704

import bend-schema-lib@0.4.1.0/core.bend as Core
import Base

704# At an SStrLen the shape comes first, as everywhere else: a value that is not
705# a string is NotString, a string out of its bounds is LengthNotIn, and a node
706# the codec refused to build or that is absent reads as it does at every kind.
707def len_err(+lo: Nat, +hi: Nat, r: Raw) -> Maybe<&2, Err>:
708  match r:
709    case RStr{+x}:
710      in_err(str_len_ok(lo, hi, x), LengthNotIn{lo, hi})
711    case RMissing{}:
712      here(Missing{})
713    case RTooBig{}:
714      here(TooLarge{})
715    case _:
716      here(NotString{})

Uses (8)

Used by (2)