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 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
- Trending
Builder - construct a trending query
- Trending
Parameters - Trending
Request
Enums§
- Language
- Github programming language enum definition
- Since
- trending period
- Spoken
Language - Spoken language of repository
- Trending
Error
Traits§
- Trend
- this trait represent different kind trending information, only repository is implemented at the moment
- Trend
Ext - 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?