#github-api #user #learn #repository

nightly rust-github

Rust 编程语言实现的用于与 Github v3 API 交互的库

2 个版本

使用旧的 Rust 2015

0.1.1 2015年3月20日
0.1.0 2015年3月20日

#56 in #github-api

MIT 许可证

5KB
119 代码行,不包括注释

Rust Github

Rust 编程语言实现的用于与 Github API 交互的库。这是一个实践库,在编写 Rust 库/应用程序的过程中使用。

示例

获取用户信息

此请求将返回单个 github::users::User 结构体。

extern crate "rust-github" as github;

use github::Github;


fn main() {
    let github = Github::new();
    let user = github.users.get("octocat");
    println!("Name: {:?}", user.name);
    println!("Email: {:?}", user.email);
    println!("Location: {:?}", user.location);
}

通过用户获取所有仓库

通过用户获取仓库列表,公开一个 Vec<github::repositories::Repository>

let github = Github::new();
let repositories = github.repositories.by_user("octocat");
for repo in repositories.iter() {
    println!("{:?}", repo.name);
}

依赖

~11MB
~251K SLoC