method DynHandle.check
Would text (JSON, or plain text for a str) be accepted as a value of this field?
Example:
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: SerializableSince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
text | str |
Returns
str
Errors
DynError where T: Serializable- `DynError` when the text is not a valid value of the type.
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/dynconf.oxl:604