From 8cdfa445d6629ffef4cb84967ff7017654045bc2 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 2 Jul 2025 18:36:06 -0600 Subject: chore: add vendor directory --- vendor/hyper/src/rt/bounds.rs | 109 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 vendor/hyper/src/rt/bounds.rs (limited to 'vendor/hyper/src/rt/bounds.rs') diff --git a/vendor/hyper/src/rt/bounds.rs b/vendor/hyper/src/rt/bounds.rs new file mode 100644 index 00000000..aa3075e0 --- /dev/null +++ b/vendor/hyper/src/rt/bounds.rs @@ -0,0 +1,109 @@ +//! Trait aliases +//! +//! Traits in this module ease setting bounds and usually automatically +//! implemented by implementing another trait. + +#[cfg(all(feature = "server", feature = "http2"))] +pub use self::h2::Http2ServerConnExec; + +#[cfg(all(feature = "client", feature = "http2"))] +pub use self::h2_client::Http2ClientConnExec; + +#[cfg(all(feature = "client", feature = "http2"))] +#[cfg_attr(docsrs, doc(cfg(all(feature = "client", feature = "http2"))))] +mod h2_client { + use std::{error::Error, future::Future}; + + use crate::rt::{Read, Write}; + use crate::{proto::h2::client::H2ClientFuture, rt::Executor}; + + /// An executor to spawn http2 futures for the client. + /// + /// This trait is implemented for any type that implements [`Executor`] + /// trait for any future. + /// + /// This trait is sealed and cannot be implemented for types outside this crate. + /// + /// [`Executor`]: crate::rt::Executor + pub trait Http2ClientConnExec: sealed_client::Sealed<(B, T)> + where + B: http_body::Body, + B::Error: Into>, + T: Read + Write + Unpin, + { + #[doc(hidden)] + fn execute_h2_future(&mut self, future: H2ClientFuture); + } + + impl Http2ClientConnExec for E + where + E: Executor>, + B: http_body::Body + 'static, + B::Error: Into>, + H2ClientFuture: Future, + T: Read + Write + Unpin, + { + fn execute_h2_future(&mut self, future: H2ClientFuture) { + self.execute(future) + } + } + + impl sealed_client::Sealed<(B, T)> for E + where + E: Executor>, + B: http_body::Body + 'static, + B::Error: Into>, + H2ClientFuture: Future, + T: Read + Write + Unpin, + { + } + + mod sealed_client { + pub trait Sealed {} + } +} + +#[cfg(all(feature = "server", feature = "http2"))] +#[cfg_attr(docsrs, doc(cfg(all(feature = "server", feature = "http2"))))] +mod h2 { + use crate::{proto::h2::server::H2Stream, rt::Executor}; + use http_body::Body; + use std::future::Future; + + /// An executor to spawn http2 connections. + /// + /// This trait is implemented for any type that implements [`Executor`] + /// trait for any future. + /// + /// This trait is sealed and cannot be implemented for types outside this crate. + /// + /// [`Executor`]: crate::rt::Executor + pub trait Http2ServerConnExec: sealed::Sealed<(F, B)> + Clone { + #[doc(hidden)] + fn execute_h2stream(&mut self, fut: H2Stream); + } + + #[doc(hidden)] + impl Http2ServerConnExec for E + where + E: Executor> + Clone, + H2Stream: Future, + B: Body, + { + fn execute_h2stream(&mut self, fut: H2Stream) { + self.execute(fut) + } + } + + impl sealed::Sealed<(F, B)> for E + where + E: Executor> + Clone, + H2Stream: Future, + B: Body, + { + } + + mod sealed { + pub trait Sealed {} + } +} -- cgit v1.2.3