From f10811e93665ee435526aaad7eb3000fc3d10571 Mon Sep 17 00:00:00 2001 From: Robert Ream <154010+robertream@users.noreply.github.com> Date: Thu, 29 Oct 2026 04:11:14 -0700 Subject: [PATCH] feat(http2): add an executor getter for server and client `Builder::new(exec)` is the only constructor on either HTTP/2 builder and the executor cannot be read back, so a caller that needs it for work alongside a connection keeps a second copy with nothing relating the two. `impl Builder` is unconstrained, so the accessor needs no bound, and returning `&E` leaves cloning to the caller. --- src/client/conn/http2.rs | 5 +++++ src/server/conn/http2.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/client/conn/http2.rs b/src/client/conn/http2.rs index 4df19a10cc..9e19d26949 100644 --- a/src/client/conn/http2.rs +++ b/src/client/conn/http2.rs @@ -314,6 +314,11 @@ where } } + /// Returns the executor this builder was created with. + pub fn executor(&self) -> &Ex { + &self.exec + } + /// Provide a timer to execute background HTTP2 tasks. pub fn timer(&mut self, timer: M) -> &mut Builder where diff --git a/src/server/conn/http2.rs b/src/server/conn/http2.rs index e4dac78bea..72f28ecbbd 100644 --- a/src/server/conn/http2.rs +++ b/src/server/conn/http2.rs @@ -120,6 +120,11 @@ impl Builder { } } + /// Returns the executor this builder was created with. + pub fn executor(&self) -> &E { + &self.exec + } + /// Configures the maximum number of pending reset streams allowed before a GOAWAY will be sent. /// /// This will default to the default value set by the [`h2` crate](https://crates.io/crates/h2).