Coverage Report

Created: 2025-10-29 07:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/hyper-util-0.1.10/src/common/exec.rs
Line
Count
Source
1
#![allow(dead_code)]
2
3
use hyper::rt::Executor;
4
use std::fmt;
5
use std::future::Future;
6
use std::pin::Pin;
7
use std::sync::Arc;
8
9
pub(crate) type BoxSendFuture = Pin<Box<dyn Future<Output = ()> + Send>>;
10
11
// Either the user provides an executor for background tasks, or we use
12
// `tokio::spawn`.
13
#[derive(Clone)]
14
pub(crate) enum Exec {
15
    Executor(Arc<dyn Executor<BoxSendFuture> + Send + Sync>),
16
}
17
18
// ===== impl Exec =====
19
20
impl Exec {
21
0
    pub(crate) fn new<E>(inner: E) -> Self
22
0
    where
23
0
        E: Executor<BoxSendFuture> + Send + Sync + 'static,
24
    {
25
0
        Exec::Executor(Arc::new(inner))
26
0
    }
Unexecuted instantiation: <hyper_util::common::exec::Exec>::new::<hyper_util::common::exec::Exec>
Unexecuted instantiation: <hyper_util::common::exec::Exec>::new::<hyper_util::rt::tokio::TokioExecutor>
Unexecuted instantiation: <hyper_util::common::exec::Exec>::new::<_>
27
28
0
    pub(crate) fn execute<F>(&self, fut: F)
29
0
    where
30
0
        F: Future<Output = ()> + Send + 'static,
31
    {
32
0
        match *self {
33
0
            Exec::Executor(ref e) => {
34
0
                e.execute(Box::pin(fut));
35
0
            }
36
        }
37
0
    }
Unexecuted instantiation: <hyper_util::common::exec::Exec>::execute::<core::pin::Pin<alloc::boxed::Box<dyn core::future::future::Future<Output = ()> + core::marker::Send>>>
Unexecuted instantiation: <hyper_util::common::exec::Exec>::execute::<futures_util::future::future::Map<futures_util::future::try_future::MapErr<hyper_util::common::lazy::Lazy<<hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::connect_to::{closure#0}, futures_util::future::either::Either<futures_util::future::try_future::AndThen<futures_util::future::try_future::MapErr<hyper_util::service::oneshot::Oneshot<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, http::uri::Uri>, <hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::connect_to::{closure#0}::{closure#0}>, futures_util::future::either::Either<core::pin::Pin<alloc::boxed::Box<<hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::connect_to::{closure#0}::{closure#1}::{closure#0}>>, futures_util::future::ready::Ready<core::result::Result<hyper_util::client::legacy::pool::Pooled<hyper_util::client::legacy::client::PoolClient<tonic::body::Body>, (http::uri::scheme::Scheme, http::uri::authority::Authority)>, hyper_util::client::legacy::client::Error>>>, <hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::connect_to::{closure#0}::{closure#1}>, futures_util::future::ready::Ready<core::result::Result<hyper_util::client::legacy::pool::Pooled<hyper_util::client::legacy::client::PoolClient<tonic::body::Body>, (http::uri::scheme::Scheme, http::uri::authority::Authority)>, hyper_util::client::legacy::client::Error>>>>, <hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::one_connection_for::{closure#0}::{closure#0}>, <hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::one_connection_for::{closure#0}::{closure#1}>>
Unexecuted instantiation: <hyper_util::common::exec::Exec>::execute::<futures_util::future::future::Map<futures_util::future::try_future::MapErr<hyper::client::conn::http2::Connection<hyper_rustls::stream::MaybeHttpsStream<hyper_util::rt::tokio::TokioIo<tokio::net::tcp::stream::TcpStream>>, tonic::body::Body, hyper_util::common::exec::Exec>, <hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::connect_to::{closure#0}::{closure#1}::{closure#0}::{closure#0}>, <hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::connect_to::{closure#0}::{closure#1}::{closure#0}::{closure#1}>>
Unexecuted instantiation: <hyper_util::common::exec::Exec>::execute::<futures_util::future::future::Map<futures_util::future::try_future::MapErr<hyper::client::conn::http1::upgrades::UpgradeableConnection<hyper_rustls::stream::MaybeHttpsStream<hyper_util::rt::tokio::TokioIo<tokio::net::tcp::stream::TcpStream>>, tonic::body::Body>, <hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::connect_to::{closure#0}::{closure#1}::{closure#0}::{closure#2}>, <hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::connect_to::{closure#0}::{closure#1}::{closure#0}::{closure#3}>>
Unexecuted instantiation: <hyper_util::common::exec::Exec>::execute::<futures_util::future::future::Map<futures_util::future::poll_fn::PollFn<<hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::try_send_request::{closure#0}::{closure#2}>, <hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::try_send_request::{closure#0}::{closure#3}>>
Unexecuted instantiation: <hyper_util::common::exec::Exec>::execute::<futures_util::future::future::Map<futures_util::future::poll_fn::PollFn<<hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::try_send_request::{closure#0}::{closure#4}>, <hyper_util::client::legacy::client::Client<hyper_rustls::connector::HttpsConnector<hyper_util::client::legacy::connect::http::HttpConnector>, tonic::body::Body>>::try_send_request::{closure#0}::{closure#5}>>
Unexecuted instantiation: <hyper_util::common::exec::Exec>::execute::<hyper_util::client::legacy::pool::IdleTask<hyper_util::client::legacy::client::PoolClient<tonic::body::Body>, (http::uri::scheme::Scheme, http::uri::authority::Authority)>>
Unexecuted instantiation: <hyper_util::common::exec::Exec>::execute::<hyper::proto::h2::client::H2ClientFuture<tonic::body::Body, hyper_rustls::stream::MaybeHttpsStream<hyper_util::rt::tokio::TokioIo<tokio::net::tcp::stream::TcpStream>>>>
Unexecuted instantiation: <hyper_util::common::exec::Exec>::execute::<_>
38
}
39
40
impl fmt::Debug for Exec {
41
0
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
42
0
        f.debug_struct("Exec").finish()
43
0
    }
44
}
45
46
impl<F> hyper::rt::Executor<F> for Exec
47
where
48
    F: Future<Output = ()> + Send + 'static,
49
{
50
0
    fn execute(&self, fut: F) {
51
0
        Exec::execute(self, fut);
52
0
    }
Unexecuted instantiation: <hyper_util::common::exec::Exec as hyper::rt::Executor<core::pin::Pin<alloc::boxed::Box<dyn core::future::future::Future<Output = ()> + core::marker::Send>>>>::execute
Unexecuted instantiation: <hyper_util::common::exec::Exec as hyper::rt::Executor<hyper::proto::h2::client::H2ClientFuture<tonic::body::Body, hyper_rustls::stream::MaybeHttpsStream<hyper_util::rt::tokio::TokioIo<tokio::net::tcp::stream::TcpStream>>>>>::execute
Unexecuted instantiation: <hyper_util::common::exec::Exec as hyper::rt::Executor<_>>::execute
53
}