fn forward_until_matching(vector: &Vec<char>, pos: &mut usize) -> bool {
    let start_char = vector.get(*pos);
    let matching_char = match start_char {
        Some(&'`') => Some(&'`'),
        Some(&'(') => Some(&')'),
        Some(&'[') => Some(&']'),
        _ => panic!(
            "no matching arm for char {:?} in forward_until_matching",
            start_char
        ),
    };

    // iterate through the chars until we've reached a char that matches
    // the start_char we began at
    let mut num_unmatched_start_chars = 1;
    while vector.get(*pos).is_some() && num_unmatched_start_chars != 0 {
        *pos += 1;

        // keep track of any new start_chars we find so we know when we've found
        // a char that matches our first start_char
        if vector.get(*pos) == start_char {
            num_unmatched_start_chars += 1;
        }
        if vector.get(*pos) == matching_char {
            num_unmatched_start_chars -= 1;
        }
    }
    vector.get(*pos).is_some()
}
/// Advance the `pos` index in the vector until reaching a character that
/// matches the character at the index `pos` began at.
///
/// # Examples
///
/// ```ignore
/// let vector = vec!['(', 'h', 'e', 'l', 'l', 'o', ' ', '(', 'w', ')', 'o', 'r', 'l', 'd', ')'];
/// let pos = 0;
///
/// let matching_char = forward_until_matching(&vector, &mut pos);
/// assert_eq!(pos, 14);
/// assert_eq!(matching_char, ')');
/// ```
Advance the `pos` index in the vector until reaching a character that
matches the character at the index `pos` began at.
Advance the ` pos ` index in the vector until reaching a character that matches the character at the index ` pos ` began at .
fn forward_until_matching(vector: &Vec<char>, pos: &mut usize) -> bool {
    let start_char = vector.get(*pos);
    let matching_char = match start_char {
        Some(&'`') => Some(&'`'),
        Some(&'(') => Some(&')'),
        Some(&'[') => Some(&']'),
        _ => panic!(
            "no matching arm for char {:?} in forward_until_matching",
            start_char
        ),
    };
    // iterate through the chars until we've reached a char that matches
    // the start_char we began at
    let mut num_unmatched_start_chars = 1;
    while vector.get(*pos).is_some() && num_unmatched_start_chars != 0 {
        *pos += 1;
        // keep track of any new start_chars we find so we know when we've found
        // a char that matches our first start_char
        if vector.get(*pos) == start_char {
            num_unmatched_start_chars += 1;
        }
        if vector.get(*pos) == matching_char {
            num_unmatched_start_chars -= 1;
        }
    }
    vector.get(*pos).is_some()
}
fn forward_until_matching ( vector : & Vec < char > , pos : & mut usize ) -> bool { let start_char = vector . get ( * pos ) ; let matching_char = match start_char { Some ( & '`' ) => Some ( & '`' ) , Some ( & '(' ) => Some ( & ')' ) , Some ( & '[' ) => Some ( & ']' ) , _ => panic ! ( " " start_char ) , } ; // iterate through the chars until we've reached a char that matches // the start_char we began at let mut num_unmatched_start_chars = 1 ; while vector . get ( * pos ) . is_some ( ) && num_unmatched_start_chars != 0 { * pos += 1 ; // keep track of any new start_chars we find so we know when we've found // a char that matches our first start_char if vector . get ( * pos ) == start_char { num_unmatched_start_chars += 1 ; } if vector . get ( * pos ) == matching_char { num_unmatched_start_chars -= 1 ; } } vector . get ( * pos ) . is_some ( ) }
Advance the `pos` index in the vector until reaching a character that
matches the character at the index `pos` began at.
Advance the ` pos ` index in the vector until reaching a character that matches the character at the index ` pos ` began at .
vector
&Vec<char>
pos
&mut usize
vector
&Vec<char>
pos
&mut usize
examples


let matching_char = forward_until_matching(&vector, &mut pos);
assert_eq!(pos, 14);
assert_eq!(matching_char, ')');
```
let matching_char = forward_until_matching ( &vector &mut pos ) ; assert_eq! ( pos 14 ) ; assert_eq! ( matching_char ' ) ' ) ; ` ` `