You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: main.rs
    path of file: ./repos/rules_rust/crate_universe/tools/urls_generator/src
    
    the code of the file until where you have to start completion: //! A helper tool for generating urls and sha256 checksums of cargo-bazel binaries and writing them to a module.

use std::collections::BTreeMap;
use std::io::{BufRead, 
    
fn locate_artifacts(artifacts_dir: &Path, url_prefix: &str) -> Vec<Artifact> {
    let artifact_dirs: Vec<PathBuf> = artifacts_dir
        .read_dir()
        .unwrap()
        .flatten()
        .filter(|entry| entry.path().is_dir())
        .map(|entry| entry.path())
        .collect();

    artifact_dirs
        .iter()
        .map(|path| {
            let triple = path.file_name().unwrap().to_string_lossy();
            let mut artifacts: Vec<Artifact> = path
                .read_dir()
                .unwrap()
                .flatten()
                .map(|f_entry| {
                    let f_path = f_entry.path();
                    let stem = f_path.file_stem().unwrap().to_string_lossy();
                    let extension = f_path
                        .extension()
                        .map(|ext| format!(".{}", ext.to_string_lossy()))
                        .unwrap_or_default();
                    Artifact {
                        url: format!("{url_prefix}/{stem}-{triple}{extension}"),
                        triple: triple.to_string(),
                        sha256: calculate_sha256(&f_entry.path()),
                    }
                })
                .collect();
            if artifacts.len() > 1 {
                panic!("Too many artifacts given for {}", triple)
            }
            artifacts.pop().unwrap()
        })
        .collect()
}