Coverage Report

Created: 2026-03-31 07:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/hyper-1.8.1/src/common/future.rs
Line
Count
Source
1
use std::{
2
    future::Future,
3
    pin::Pin,
4
    task::{Context, Poll},
5
};
6
7
// TODO: replace with `std::future::poll_fn` once MSRV >= 1.64
8
0
pub(crate) fn poll_fn<T, F>(f: F) -> PollFn<F>
9
0
where
10
0
    F: FnMut(&mut Context<'_>) -> Poll<T>,
11
{
12
0
    PollFn { f }
13
0
}
14
15
pub(crate) struct PollFn<F> {
16
    f: F,
17
}
18
19
impl<F> Unpin for PollFn<F> {}
20
21
impl<T, F> Future for PollFn<F>
22
where
23
    F: FnMut(&mut Context<'_>) -> Poll<T>,
24
{
25
    type Output = T;
26
27
0
    fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
28
0
        (self.as_mut().f)(cx)
29
0
    }
30
}