(parent: &HashMap<String, String>, src: &str, dst: &str)
| 166 | } |
| 167 | |
| 168 | fn reconstruct(parent: &HashMap<String, String>, src: &str, dst: &str) -> Vec<String> { |
| 169 | let mut path: Vec<String> = Vec::new(); |
| 170 | let mut cursor = dst.to_string(); |
| 171 | path.push(cursor.clone()); |
| 172 | while cursor != src { |
| 173 | match parent.get(&cursor) { |
| 174 | Some(p) => { |
| 175 | cursor = p.clone(); |
| 176 | path.push(cursor.clone()); |
| 177 | } |
| 178 | None => break, |
| 179 | } |
| 180 | } |
| 181 | path.reverse(); |
| 182 | path |
| 183 | } |
no test coverage detected