From 47b2a1e31a2ba26e2e592b548ae1384c573338cc Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Sat, 20 Jul 2024 12:58:51 -0700 Subject: [PATCH 1/2] Make private, expose total elapsed --- crates/twirp/src/server.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/twirp/src/server.rs b/crates/twirp/src/server.rs index 2b756d0..532b33a 100644 --- a/crates/twirp/src/server.rs +++ b/crates/twirp/src/server.rs @@ -164,15 +164,15 @@ pub async fn not_found_handler() -> Response { #[derive(Debug, Clone, Copy)] pub struct Timings { // When the request started. - pub start: Instant, + start: Instant, // When the request was received (headers and body). - pub request_received: Option, + request_received: Option, // When the request body was parsed. - pub request_parsed: Option, + request_parsed: Option, // When the response handler returned. - pub response_handled: Option, + response_handled: Option, // When the response was written. - pub response_written: Option, + response_written: Option, } impl Timings { @@ -234,6 +234,11 @@ impl Timings { _ => None, } } + + /// The total duration since the request started. + pub fn total_duration(&self) -> Duration { + self.start.elapsed() + } } #[cfg(test)] From d286188867691624adc06dff2ec96cd50b989037 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Tue, 23 Jul 2024 14:41:29 -0700 Subject: [PATCH 2/2] version 0.5 --- Cargo.lock | 4 ++-- crates/twirp-build/Cargo.toml | 2 +- crates/twirp/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 271f3f1..f716e62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1104,7 +1104,7 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "twirp" -version = "0.4.0" +version = "0.5.0" dependencies = [ "async-trait", "axum", @@ -1124,7 +1124,7 @@ dependencies = [ [[package]] name = "twirp-build" -version = "0.4.0" +version = "0.5.0" dependencies = [ "prost-build", ] diff --git a/crates/twirp-build/Cargo.toml b/crates/twirp-build/Cargo.toml index 650577d..0b3d88c 100644 --- a/crates/twirp-build/Cargo.toml +++ b/crates/twirp-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "twirp-build" -version = "0.4.0" +version = "0.5.0" authors = ["The blackbird team "] edition = "2021" description = "Code generation for async-compatible Twirp RPC interfaces." diff --git a/crates/twirp/Cargo.toml b/crates/twirp/Cargo.toml index fc88453..f08564e 100644 --- a/crates/twirp/Cargo.toml +++ b/crates/twirp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "twirp" -version = "0.4.0" +version = "0.5.0" authors = ["The blackbird team "] edition = "2021" description = "An async-compatible library for Twirp RPC in Rust." pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy