File: newest.rs

package info (click to toggle)
rust-debbugs 0.1.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 320 kB
  • sloc: makefile: 4
file content (26 lines) | stat: -rw-r--r-- 740 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
//! Fetch the 10 newest bugs from the Debian bug tracking system
//!
//! This example demonstrates how to use the async client to retrieve
//! the most recently reported bugs. The result is a list of bug IDs
//! ordered from newest to oldest.
//!
//! Run with: cargo run --example newest --features tokio

#[tokio::main]
async fn main() {
    #[cfg(feature = "env_logger")]
    env_logger::init();

    use debbugs::Debbugs;

    let debbugs = Debbugs::default();
    match debbugs.newest_bugs(10).await {
        Ok(bugs) => {
            println!("Latest 10 bugs:");
            for bug_id in bugs {
                println!("  Bug #{}", bug_id);
            }
        }
        Err(e) => eprintln!("Error fetching bugs: {}", e),
    }
}