Skip to content

Commit a5eb1dc

Browse files
committed
refactor(http/retry): ForwardCompatibleBody::poll_frame()
in the same manner as the existing `frame()` method mimics `http_body_util::BodyExt::frame()`, this commit introduces a new `ForwardCompatibleBody::poll_frame()` method. this allows us to poll the compatibility layer for a `Frame<T>`. Signed-off-by: katelyn martin <kate@buoyant.io>
1 parent 4e2d65e commit a5eb1dc

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

linkerd/http/retry/src/compat.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
//! Compatibility utilities for upgrading to http-body 1.0.
22
33
use http_body::{Body, SizeHint};
4+
use std::{
5+
future::Future,
6+
pin::Pin,
7+
task::{Context, Poll},
8+
};
49

510
pub(crate) use self::frame::Frame;
611

@@ -54,6 +59,18 @@ impl<B: Body> ForwardCompatibleBody<B> {
5459
}
5560
}
5661

62+
impl<B: Body + Unpin> ForwardCompatibleBody<B> {
63+
#[allow(unused, reason = "not yet used")]
64+
pub(crate) fn poll_frame(
65+
self: Pin<&mut Self>,
66+
cx: &mut Context<'_>,
67+
) -> Poll<Option<Result<Frame<B::Data>, B::Error>>> {
68+
let mut fut = self.get_mut().frame();
69+
let pinned = Pin::new(&mut fut);
70+
pinned.poll(cx)
71+
}
72+
}
73+
5774
/// Future that resolves to the next frame from a `Body`.
5875
///
5976
/// NB: This is a vendored stand-in for [`Frame<'a, T>`][frame], and and can be replaced once

0 commit comments

Comments
 (0)