Skip to content

Commit 8bae438

Browse files
committed
feat(http2): add Builder::executor
`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<E> Builder<E>` is unconstrained, so the accessor needs no bound, and returning `&E` leaves cloning to the caller.
1 parent b073378 commit 8bae438

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎src/client/conn/http2.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ where
314314
}
315315
}
316316

317+
/// Returns the executor this builder was created with.
318+
pub fn executor(&self) -> &Ex {
319+
&self.exec
320+
}
321+
317322
/// Provide a timer to execute background HTTP2 tasks.
318323
pub fn timer<M>(&mut self, timer: M) -> &mut Builder<Ex>
319324
where

‎src/server/conn/http2.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ impl<E> Builder<E> {
120120
}
121121
}
122122

123+
/// Returns the executor this builder was created with.
124+
pub fn executor(&self) -> &E {
125+
&self.exec
126+
}
127+
123128
/// Configures the maximum number of pending reset streams allowed before a GOAWAY will be sent.
124129
///
125130
/// This will default to the default value set by the [`h2` crate](https://crates.io/crates/h2).

0 commit comments

Comments
 (0)