better documentation

This commit is contained in:
Zynh0722 2024-04-24 08:16:53 -07:00
parent 85a553080a
commit 36118c3299

View file

@ -98,13 +98,14 @@ fn main() {
.flatten() .flatten()
.collect(); .collect();
// Storing airport data as a list of reference counted pointers
let mut airports: Airports = HashMap::new(); let mut airports: Airports = HashMap::new();
for record in &data { for record in &data {
insert_airports_from_record(&mut airports, record); insert_airports_from_record(&mut airports, record);
} }
let _code_to_id: HashMap<String, usize> = HashMap::from_iter( // Index for converting airport codes to airport ids
let code_to_id: HashMap<String, usize> = HashMap::from_iter(
airports airports
.iter() .iter()
.map(|(id, airport)| (airport.code.clone(), *id)), .map(|(id, airport)| (airport.code.clone(), *id)),
@ -132,7 +133,7 @@ fn main() {
// Using command line arguments as input // Using command line arguments as input
let args: Vec<String> = env::args().collect(); let args: Vec<String> = env::args().collect();
let (origin_id, destination_id) = cmd::handle_args(args, _code_to_id); let (origin_id, destination_id) = cmd::handle_args(args, code_to_id);
println!("{:#?} {:#?}", graph[&origin_id], graph[&destination_id]); println!("{:#?} {:#?}", graph[&origin_id], graph[&destination_id]);
} }