fn validate_date(string: &str) -> Result<(), Error> {
    let mut parts = string.split('-');

    check_date_part!("year", string, parts, 4, YEAR_MIN, YEAR_MAX);
    check_date_part!("month", string, parts, 2, 1, 12);
    // TODO: ensure day is in range for month
    check_date_part!("day", string, parts, 2, 1, 31);

    if parts.next().is_some() {
        fail!(ErrorKind::Parse, "invalid date: {}", string)
    }

    Ok(())
}
/// Validate that a date is well-formed
Validate that a date is well-formed
Validate that a date is well - formed
fn validate_date(string: &str) -> Result<(), Error> {
    let mut parts = string.split('-');
    check_date_part!("year", string, parts, 4, YEAR_MIN, YEAR_MAX);
    check_date_part!("month", string, parts, 2, 1, 12);
    // TODO: ensure day is in range for month
    check_date_part!("day", string, parts, 2, 1, 31);
    if parts.next().is_some() {
        fail!(ErrorKind::Parse, "invalid date: {}", string)
    }
    Ok(())
}
fn validate_date ( string : & str ) -> Result < ( ) , Error > { let mut parts = string . split ( '-' ) ; check_date_part ! ( " " string parts 4 YEAR_MIN YEAR_MAX ) ; check_date_part ! ( " " string parts 2 1 12 ) ; // TODO: ensure day is in range for month check_date_part ! ( " " string parts 2 1 31 ) ; if parts . next ( ) . is_some ( ) { fail ! ( ErrorKind Parse " " string ) } Ok ( ( ) ) }
Validate that a date is well-formed
Validate that a date is well - formed
string
&str
string
&str