File: paging_results.rs

package info (click to toggle)
rust-octocrab 0.43.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,532 kB
  • sloc: makefile: 2
file content (27 lines) | stat: -rw-r--r-- 628 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use octocrab::{params, Octocrab};

#[tokio::main]
async fn main() -> octocrab::Result<()> {
    let octocrab = Octocrab::default();

    let mut current_page = octocrab
        .orgs("rust-lang")
        .list_repos()
        .repo_type(params::repos::Type::Sources)
        .per_page(100)
        .send()
        .await?;
    let mut prs = current_page.take_items();

    while let Ok(Some(mut new_page)) = octocrab.get_page(&current_page.next).await {
        prs.extend(new_page.take_items());

        for pr in prs.drain(..) {
            println!("{pr:?}");
        }

        current_page = new_page;
    }

    Ok(())
}