Expand description
§GitHub Trending Repositories in Rust
A simple Rust crate to fetch trending repositories from GitHub.
§Usage
§Example: Get daily Rust trending repositories
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 GLWT (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
- Trending
Builder
Enums§
- Error
- Language
- Github programming language enum definition
- Since
- trending period
- Spoken
Language - Spoken language of repository
Traits§
- Extract
- trending information extraction interface the input text is the raw HTML text from the requesting response
- Trend
Ext - Extend reqwest::Client with a method to create a TrendBuilder This trait is not meant to be general but to make API simplier since we don’t require any additional information like api keys