rustgtrending

Crates.iorustgtrending
lib.rsrustgtrending
version0.1.1
sourcesrc
created_at2020-12-05 16:11:26.832033
updated_at2020-12-08 16:46:43.046426
description A library to access the github trendinding API
homepagehttps://github.com/yvonmanzi/rust-gtrending
repositoryhttps://github.com/yvonmanzi/rust-gtrending
max_upload_size
id319860
size63,713
Yvon Manzi (yvonmanzi)

documentation

README

#rustgtrending

Lightweight and easy-to-use rust library for fetching trending repositories and developers. Relies on github-trending-api which is in JavaScript, so gtrending aims to fill the gap for rust.

Simple Example

  • Fetch trending devs:

use tokio;
use rustgtrending;
use std::error::Error;
/// Use tokio runtime to enable asynchronous coding.
/// Without a runtime, rust can't be able to call asynchronous functions
/// such as `rustgtrending::fetch_developers`
[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let language = "rust";
    /// since can be one of "daily", "weekly", or "monthly"
    let since = "daily";
    // Now we fetch trending developers from Github
    let devs = rustgtrending::fetch_developers(language, since).await?;
    println!("{:?}", devs);
    Ok(())
}
  • Fetch trending repositories:

use tokio;
use rustgtrending;
use std::error::Error;
[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let language = "rust";
    /// `since` can be one of "daily", "weekly", or "monthly"
    let since = "weekly";
    /// Let's use `en` for English.
    let spoken_language_code = "en";
    // Now we fetch trending repositories from Github
    let devs = rustgtrending::fetch_repos(language, spoken_language_code, since).await?;
    println!("{:?}", devs);
    Ok(())
}
Commit count: 6

cargo fmt