fn parse_into_policy_password(input_line: &str) -> Option<(Policy, Password)> {
    let split: Vec<_> = input_line.split_whitespace().collect();

    if split.len() != 3 {
        return None;
    }

    // we know there will be 2 chunks in policy due to the described structure
    let policy_raw = vec![split[0], split[1]].join(" ");
    let password = split[2];
    let policy = Policy::try_from(policy_raw).ok()?;

    Some((policy, password))
}
// input is formatted as follows:
// `lowerbound-upperbound character: password`
// for example: `1-3 a: abcde`
// note that final space separates policy from password
input is formatted as follows:
`lowerbound-upperbound character: password`
for example: `1-3 a: abcde`
note that final space separates policy from password
input is formatted as follows : ` lowerbound - upperbound character : password ` for example : ` 1 - 3 a : abcde ` note that final space separates policy from password
fn parse_into_policy_password(input_line: &str) -> Option<(Policy, Password)> {
    let split: Vec<_> = input_line.split_whitespace().collect();
    if split.len() != 3 {
        return None;
    }
    // we know there will be 2 chunks in policy due to the described structure
    let policy_raw = vec![split[0], split[1]].join(" ");
    let password = split[2];
    let policy = Policy::try_from(policy_raw).ok()?;
    Some((policy, password))
}
fn parse_into_policy_password ( input_line : & str ) -> Option < ( Policy , Password ) > { let split : Vec < _ > = input_line . split_whitespace ( ) . collect ( ) ; if split . len ( ) != 3 { return None ; } // we know there will be 2 chunks in policy due to the described structure let policy_raw = vec ! [ split [ 0 ] split [ 1 ] ] . join ( " " ) ; let password = split [ 2 ] ; let policy = Policy :: try_from ( policy_raw ) . ok ( ) ? ; Some ( ( policy , password ) ) }
input is formatted as follows:
`lowerbound-upperbound character: password`
for example: `1-3 a: abcde`
note that final space separates policy from password
input is formatted as follows : ` lowerbound - upperbound character : password ` for example : ` 1 - 3 a : abcde ` note that final space separates policy from password
input_line
&str
input_line
&str