Skip to main content

Module config

Module config 

Source
Expand description

Configuration types and contexts for benchmarks.

This module contains types used to configure benchmarks and pass context to hooks and generator functions:

§Examples

Using request context for dynamic URLs:

use httpress::{Benchmark, RequestContext, RequestConfig, HttpMethod};
use std::collections::HashMap;

Benchmark::builder()
    .request_fn(|ctx: RequestContext| {
        RequestConfig {
            url: format!("http://localhost:3000/user/{}", ctx.request_number),
            method: HttpMethod::Get,
            headers: HashMap::new(),
            body: None,
        }
    })
    .requests(100)
    .build()?;

Structs§

AfterRequestContext
Context passed to after-request hook functions.
BeforeRequestContext
Context passed to before-request hook functions.
BenchConfig
Benchmark configuration
RateContext
Context passed to rate generator functions.
RequestConfig
Configuration for a single HTTP request.
RequestContext
Context passed to request generator functions.

Enums§

HookAction
Action returned by hook functions to control request execution.
HttpMethod
HTTP method for requests.
RequestSource
Source of request configuration - either static or dynamically generated.
StopCondition
Defines when the benchmark should stop

Type Aliases§

AfterRequestHook
Type alias for after-request hook functions.
BeforeRequestHook
Type alias for before-request hook functions.
RateFunction
Type alias for rate generator functions.
RequestGenerator
Type alias for request generator functions.