fn config_overrides(config: &mut BenchmarkConfig, matches: &Matches) -> Result<(), String> {
    if let Some(threads) = parse_opt("threads", matches)? {
        config.set_threads(threads);
    }

    if let Some(connections) = parse_opt("connections", matches)? {
        config.set_poolsize(connections);
    }

    if let Some(windows) = parse_opt("windows", matches)? {
        config.set_windows(windows);
    }

    if let Some(duration) = parse_opt("duration", matches)? {
        config.set_duration(duration);
    }

    // TODO: In the future we will implement exponential backoff instead of
    // exponentially increasing timeouts. For now, []-timeout serves as the base
    // or minimum timeout. Setting max-[]-timeout to the same value ensures old
    // behavior
    if let Some(t) = parse_opt("request-timeout", matches)? {
        config.set_base_request_timeout(Some(t));
    }

    if let Some(t) = parse_opt("max-request-timeout", matches)? {
        config.set_max_request_timeout(Some(t));
    }

    if let Some(t) = parse_opt("connect-timeout", matches)? {
        config.set_base_connect_timeout(Some(t));
    }

    if let Some(t) = parse_opt("max-connect-timeout", matches)? {
        config.set_max_connect_timeout(Some(t));
    }

    if let Some(t) = parse_opt("connect-ratelimit", matches)? {
        config.set_connect_ratelimit(Some(t));
    }

    if matches.opt_present("tcp-nodelay") {
        config.set_tcp_nodelay(true);
    }

    Ok(())
}
/// Override parameters using command line arguments
Override parameters using command line arguments
Override parameters using command line arguments
fn config_overrides(config: &mut BenchmarkConfig, matches: &Matches) -> Result<(), String> {
    if let Some(threads) = parse_opt("threads", matches)? {
        config.set_threads(threads);
    }
    if let Some(connections) = parse_opt("connections", matches)? {
        config.set_poolsize(connections);
    }
    if let Some(windows) = parse_opt("windows", matches)? {
        config.set_windows(windows);
    }
    if let Some(duration) = parse_opt("duration", matches)? {
        config.set_duration(duration);
    }
    // TODO: In the future we will implement exponential backoff instead of
    // exponentially increasing timeouts. For now, []-timeout serves as the base
    // or minimum timeout. Setting max-[]-timeout to the same value ensures old
    // behavior
    if let Some(t) = parse_opt("request-timeout", matches)? {
        config.set_base_request_timeout(Some(t));
    }
    if let Some(t) = parse_opt("max-request-timeout", matches)? {
        config.set_max_request_timeout(Some(t));
    }
    if let Some(t) = parse_opt("connect-timeout", matches)? {
        config.set_base_connect_timeout(Some(t));
    }
    if let Some(t) = parse_opt("max-connect-timeout", matches)? {
        config.set_max_connect_timeout(Some(t));
    }
    if let Some(t) = parse_opt("connect-ratelimit", matches)? {
        config.set_connect_ratelimit(Some(t));
    }
    if matches.opt_present("tcp-nodelay") {
        config.set_tcp_nodelay(true);
    }
    Ok(())
}
fn config_overrides ( config : & mut BenchmarkConfig , matches : & Matches ) -> Result < ( ) , String > { if let Some ( threads ) = parse_opt ( " " , matches ) ? { config . set_threads ( threads ) ; } if let Some ( connections ) = parse_opt ( " " , matches ) ? { config . set_poolsize ( connections ) ; } if let Some ( windows ) = parse_opt ( " " , matches ) ? { config . set_windows ( windows ) ; } if let Some ( duration ) = parse_opt ( " " , matches ) ? { config . set_duration ( duration ) ; } // TODO: In the future we will implement exponential backoff instead of // exponentially increasing timeouts. For now, []-timeout serves as the base // or minimum timeout. Setting max-[]-timeout to the same value ensures old // behavior if let Some ( t ) = parse_opt ( " " , matches ) ? { config . set_base_request_timeout ( Some ( t ) ) ; } if let Some ( t ) = parse_opt ( " " , matches ) ? { config . set_max_request_timeout ( Some ( t ) ) ; } if let Some ( t ) = parse_opt ( " " , matches ) ? { config . set_base_connect_timeout ( Some ( t ) ) ; } if let Some ( t ) = parse_opt ( " " , matches ) ? { config . set_max_connect_timeout ( Some ( t ) ) ; } if let Some ( t ) = parse_opt ( " " , matches ) ? { config . set_connect_ratelimit ( Some ( t ) ) ; } if matches . opt_present ( " " ) { config . set_tcp_nodelay ( true ) ; } Ok ( ( ) ) }
Override parameters using command line arguments
Override parameters using command line arguments
config
&mut BenchmarkConfig
matches
&Matches
config
&mut BenchmarkConfig
matches
&Matches