INNER CODE UNIT · Rust

repo_info

flosse/rust-web-framework-comparison · src/main.rs:448

fn repo_info(name: &str, repo: &Url) -> RepoInfo {
    let (repo, stars, contributors, activity) = match repo.host() {
        Some(Host::Domain("github.com")) => {
            let path = repo.path();
            let repo =
                format!("[![{name} repo](https://img.shields.io/badge/GitHub-git-blue)]({repo})");
            let stars =
                format!("![{name} stars](https://img.shields.io/github/stars{path}.svg?label=%20)");
            let contributors = format!("![{name} contributors](https://img.shields.io/github/contributors{path}.svg?label=%20)");
            let activity =  format!("![{name} activity](https://img.shields.io/github/commit-activity/y{path}.svg?label=%20)");
            (repo, stars, contributors, activity)
        }
        Some(Host::Domain("gitlab.com")) => (
            format!("[![Repo](https://img.shields.io/badge/GitLab-git-blue)]({repo})"),
            String::new(),
            String::new(),
            String::new(),
        ),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…