fn parse(s: &str) -> Input {
  let mut ret = Input::default();
  for (y, line) in s.lines().enumerate() {
    for (x, b) in line.bytes().enumerate() {
      match b {
        b'@' => ret.start = (x, y),
        b'.' => {}
        b'#' => continue,
        _ => {
          if b.is_ascii_lowercase() {
            ret.nodes.insert((x, y), Node::Key(b - b'a'));
          } else if b.is_ascii_uppercase() {
            ret.nodes.insert((x, y), Node::Door(b - b'A'));
          } else {
            panic!("bad byte: {}", b)
          }
        }
      }
      ret.walkable.insert((x, y));
    }
  }
  ret
}
/// the returned `nodes` contains only Key and Door nodes
the returned `nodes` contains only Key and Door nodes
the returned ` nodes ` contains only Key and Door nodes
fn parse(s: &str) -> Input {
  let mut ret = Input::default();
  for (y, line) in s.lines().enumerate() {
    for (x, b) in line.bytes().enumerate() {
      match b {
        b'@' => ret.start = (x, y),
        b'.' => {}
        b'#' => continue,
        _ => {
          if b.is_ascii_lowercase() {
            ret.nodes.insert((x, y), Node::Key(b - b'a'));
          } else if b.is_ascii_uppercase() {
            ret.nodes.insert((x, y), Node::Door(b - b'A'));
          } else {
            panic!("bad byte: {}", b)
          }
        }
      }
      ret.walkable.insert((x, y));
    }
  }
  ret
}
fn parse ( s : & str ) -> Input { let mut ret = Input :: default ( ) ; for ( y , line ) in s . lines ( ) . enumerate ( ) { for ( x , b ) in line . bytes ( ) . enumerate ( ) { match b { b'@' => ret . start = ( x , y ) , b'.' => { } b'#' => continue , _ => { if b . is_ascii_lowercase ( ) { ret . nodes . insert ( ( x , y ) , Node :: Key ( b - b'a' ) ) ; } else if b . is_ascii_uppercase ( ) { ret . nodes . insert ( ( x , y ) , Node :: Door ( b - b'A' ) ) ; } else { panic ! ( " " b ) } } } ret . walkable . insert ( ( x , y ) ) ; } } ret }
the returned `nodes` contains only Key and Door nodes
the returned ` nodes ` contains only Key and Door nodes
s
&str
s
&str