Skip to main content

range_i64

Function range_i64 

Source
pub fn range_i64(
    lo: i64,
    hi: i64,
    msg: impl Into<String>,
) -> impl Fn(&str) -> Result<(), String>
Expand description

Parse the input as an i64 and require it to fall within lo..=hi.

Non-numeric input fails with msg.

§Example

let field = FormField::new("Age").validate(validators::range_i64(0, 120, "0–120 only"));