fn check_rational_fract(v: Value) -> Result<Rational, String> {
    let val = check::numeric(v)?
        .as_unit_def(Unit::None)
        .ok_or_else(|| "xyzzy".to_string())?;
    if val < 0.into() || val > 1.into() {
        Err(expected_to(&val, "be within 0 and 1"))
    } else {
        val.as_ratio().map_err(|e| e.to_string())
    }
}
/// Get a rational number in the 0..1 range.
Get a rational number in the 0..1 range.
Get a rational number in the 0 .. 1 range .
fn check_rational_fract(v: Value) -> Result<Rational, String> {
    let val = check::numeric(v)?
        .as_unit_def(Unit::None)
        .ok_or_else(|| "xyzzy".to_string())?;
    if val < 0.into() || val > 1.into() {
        Err(expected_to(&val, "be within 0 and 1"))
    } else {
        val.as_ratio().map_err(|e| e.to_string())
    }
}
fn check_rational_fract ( v : Value ) -> Result < Rational , String > { let val = check :: numeric ( v ) ? . as_unit_def ( Unit :: None ) . ok_or_else ( | | " " . to_string ( ) ) ? ; if val < 0 . into ( ) || val > 1 . into ( ) { Err ( expected_to ( & val , " " ) ) } else { val . as_ratio ( ) . map_err ( | e | e . to_string ( ) ) } }
Get a rational number in the 0..1 range.
Get a rational number in the 0 .. 1 range .
v
Value