Skip to content

Commit e77cefe

Browse files
authored
fix(example): change TokioTimer usage to match hyper-util end-user experience (hyperium#3658)
1 parent 56ef0cc commit e77cefe

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

benches/support/tokiort.rs

+7
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ impl Timer for TokioTimer {
4949
}
5050
}
5151

52+
impl TokioTimer {
53+
/// Create a new TokioTimer
54+
pub fn new() -> Self {
55+
Self {}
56+
}
57+
}
58+
5259
// Use TokioSleep to get tokio::time::Sleep to implement Unpin.
5360
// see https://docs.rs/tokio/latest/tokio/time/struct.Sleep.html
5461
pin_project! {

examples/hello.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
5353
// Handle the connection from the client using HTTP1 and pass any
5454
// HTTP requests received on that connection to the `hello` function
5555
if let Err(err) = http1::Builder::new()
56-
.timer(TokioTimer)
56+
.timer(TokioTimer::new())
5757
.serve_connection(io, service_fn(hello))
5858
.await
5959
{

0 commit comments

Comments
 (0)