Crates.io | simple-server-timing-header |
lib.rs | simple-server-timing-header |
version | 0.1.1 |
source | src |
created_at | 2023-02-13 18:57:14.327309 |
updated_at | 2023-02-20 21:04:20.454198 |
description | A simple `Server-Timing` header crate. No dependencies. |
homepage | |
repository | |
max_upload_size | |
id | 784184 |
size | 84,568 |
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());
}