test_json_output/
test_json_output.rs

1use rperf3::{Client, Config};
2use std::time::Duration;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    env_logger::init();
7
8    let config = Config::client("127.0.0.1".to_string(), 5201)
9        .with_duration(Duration::from_secs(3))
10        .with_json(true);
11
12    let client = Client::new(config)?;
13
14    match client.run().await {
15        Ok(_) => println!("\nTest completed successfully"),
16        Err(e) => eprintln!("\nError: {}", e),
17    }
18
19    Ok(())
20}