Crate github_trending_rs

Source
Expand description

crates.io docs.rs

A simple Rust crate to fetch trending repositories from GitHub.

§Usage

use std::time::Duration;

use github_trending_rs::{Language, Since, TrendExt};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let client = reqwest::ClientBuilder::new()
        .connect_timeout(Duration::from_secs(5))
        .timeout(Duration::from_secs(10))
        .build()?;

    let repos = client
        .github_trending()
        .with_language(Language::Rust)
        .since(Since::Daily)
        .repositories()
        .await?
        .all();

    for repo in repos {
        println!("{:#?}", repo);
    }

    Ok(())
}

§Limitations

  • This crate relies on GitHub’s public API. Changes to GitHub’s website or rate limiting policies may affect functionality.
  • The HTML parsing is based on the current structure of GitHub’s trending page, which could change over time.

§License

This project is licensed under the GLWTPL (Good Luck With That Public License). See the LICENSE file for more details.

Structs§

Repository
A trending github repository, may add more fields later
Trending
TrendingBuilder
construct a trending query
TrendingParameters
TrendingRequest

Enums§

Language
Github programming language enum definition
Since
trending period
SpokenLanguage
Spoken language of repository
TrendingError

Traits§

Trend
this trait represent different kind trending information, only repository is implemented at the moment
TrendExt
this trait is an attempt to support multiple HTTP client backend, also we only need parameters for requesting trending information, so we use extension trait to let user requesting trending information with corresponding HTTP client directly for simplicity, we only support async HTTP client TODO: maybe this should be a sealed trait?