miku-server-timing

Crates.iomiku-server-timing
lib.rsmiku-server-timing
version
sourcesrc
created_at2024-12-13 19:24:23.511625+00
updated_at2025-01-15 04:35:38.842286+00
descriptionAn axum layer to inject the Server-Timing HTTP header into the response.
homepage
repositoryhttps://github.com/cxw620/miku-server-timing
max_upload_size
id1482448
Cargo.toml error:TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Hantong Chen (cxw620)

documentation

README

miku-server-timing

Latest Version

An axum layer to inject the Server-Timing HTTP header into the response.

For a reference on the header please see developer.mozilla.org.

Examples

Using the layer to inject the Server-Timing Header.

    let app = Router::new()
        .route("/", get(handler))
        .layer(miku_server_timing::ServerTimingLayer::new("HelloService"));
HTTP/1.1 200 OK
content-type: text/html; charset=utf-8
content-length: 22
server-timing: HelloService;dur=102.0
date: Wed, 19 Apr 2023 15:25:40 GMT

<h1>Hello, World!</h1>

Using the layer to inject the Server-Timing Header with description.

    let app = Router::new()
        .route("/", get(handler))
        .layer(
            miku_server_timing::ServerTimingLayer::new("HelloService")
                .with_description("whatever")
        );
HTTP/1.1 200 OK
content-type: text/html; charset=utf-8
content-length: 22
server-timing: HelloService;desc="whatever";dur=102.0
date: Wed, 19 Apr 2023 15:25:40 GMT

<h1>Hello, World!</h1>

Special thanks

axum-server-timing

This crate is a fork of the above crate, modified to gain better performance, and can serve as a simple replacement.

Commit count: 6

cargo fmt