OxL Reference

method DynHandle.check

Would text (JSON, or plain text for a str) be accepted as a value of this field?

Example:

oxl✓ checked in CI
dynamic Limits {
  rps: u32 = 100
  title: str = "shop"
}

fn main() io {
  let l = Limits.get()
  match l.rps.check("250") {
    str s => print("ok {s}")
    DynError _ => print("bad")
  }
  match l.rps.check("-1") {
    str s => print("ok {s}")
    DynError _ => print("bad")
  }
}
Output
ok 250
bad
pub(api) fn check(text: str) -> str | DynError where T: Serializable

Since. 1.0.0-beta

Parameters

NameType
textstr

Returns

str

Errors

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/dynconf.oxl:604

See also