simple-server-timing-header

Crates.iosimple-server-timing-header
lib.rssimple-server-timing-header
version0.1.1
sourcesrc
created_at2023-02-13 18:57:14.327309
updated_at2023-02-20 21:04:20.454198
descriptionA simple `Server-Timing` header crate. No dependencies.
homepage
repository
max_upload_size
id784184
size84,568
Joep Meindertsma (joepio)

documentation

README

simple-server-timing-header

crates.io Documentation

Lightweight zero-dependency Rust crate that adds a Server-Timing header to the response of a request.


use simple_server_timing_header::Timer;

fn handle_request() {
    let mut timer = Timer::new();
    // ... do some stuff
    timer.add("parse_headers");
    // ... do some more stuff
    timer.add("get_db_data");
    // Sets the `Server-Timing: parse_headers;dur=0.1, get_db_data;dur=0.2` header
    add_header(timer.header_key(), timer.header_value());
}

Example of server-timing in Chrome dev tools

Commit count: 0

cargo fmt