This commit is contained in:
nora 2023-03-07 17:23:04 +01:00
parent 8b35cfc701
commit 73c1b46631
3 changed files with 8 additions and 31 deletions

View file

@ -1,5 +1,3 @@
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![cfg_attr(test, deny(rust_2018_idioms))] #![cfg_attr(test, deny(rust_2018_idioms))]
#![cfg_attr(all(test, feature = "full"), deny(unreachable_pub))] #![cfg_attr(all(test, feature = "full"), deny(unreachable_pub))]
#![cfg_attr(all(test, feature = "full"), deny(warnings))] #![cfg_attr(all(test, feature = "full"), deny(warnings))]

View file

@ -23,12 +23,7 @@ pub struct Builder<I, E = Exec> {
incoming: I, incoming: I,
protocol: E, protocol: E,
} }
#[cfg_attr(docsrs, doc(cfg(any(feature = "http1", feature = "http2"))))]
impl<I> Server<I, ()> {
pub fn builder(incoming: I) -> Builder<I> {
loop {}
}
}
#[cfg(feature = "tcp")] #[cfg(feature = "tcp")]
#[cfg_attr( #[cfg_attr(
docsrs, docsrs,
@ -40,6 +35,10 @@ impl Server<AddrIncoming, ()> {
} }
} }
fn mk<T>() -> T {
loop {}
}
#[cfg_attr(docsrs, doc(cfg(any(feature = "http1", feature = "http2"))))] #[cfg_attr(docsrs, doc(cfg(any(feature = "http1", feature = "http2"))))]
impl<I, IO, IE, S, E> Future for Server<I, S, E> impl<I, IO, IE, S, E> Future for Server<I, S, E>
where where
@ -49,26 +48,14 @@ where
E: NewSvcExec<IO, S::Service, E, NoopWatcher>, E: NewSvcExec<IO, S::Service, E, NoopWatcher>,
{ {
type Output = (); type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> { fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
loop { loop {
let fut = NewSvcTask::new(NoopWatcher); let _a: NewSvcTask<IO, <S as MakeServiceRef<IO, Body>>::Service, E, NoopWatcher> = mk();
unsafe {
self.as_mut()
.get_unchecked_mut()
.protocol
.execute_new_svc(fut);
}
} }
} }
} }
impl<I, E> Builder<I, E> { impl<I, E> Builder<I, E> {
#[doc(hidden)]
#[cfg(feature = "http1")]
pub fn http1_pipeline_flush(self, val: bool) -> Self {
loop {}
}
pub fn serve<S, B>(self, _: S) -> Server<I, S> pub fn serve<S, B>(self, _: S) -> Server<I, S>
where where
I: Accept, I: Accept,
@ -91,7 +78,7 @@ where
} }
pub(crate) mod new_svc { pub(crate) mod new_svc {
use super::Watcher; use super::Watcher;
use crate::body::{Body, HttpBody}; use crate::body::Body;
use crate::common::exec::ConnStreamExec; use crate::common::exec::ConnStreamExec;
use crate::common::{task, Future, Pin, Poll}; use crate::common::{task, Future, Pin, Poll};
use crate::service::HttpService; use crate::service::HttpService;

View file

@ -8,8 +8,6 @@ pub(crate) trait MakeConnection<Target>: self::sealed::Sealed<(Target,)> {
type Connection: AsyncRead + AsyncWrite; type Connection: AsyncRead + AsyncWrite;
type Error; type Error;
type Future: Future<Output = Result<Self::Connection, Self::Error>>; type Future: Future<Output = Result<Self::Connection, Self::Error>>;
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>>;
fn make_connection(&mut self, target: Target) -> Self::Future;
} }
impl<S, Target> self::sealed::Sealed<(Target,)> for S where S: Service<Target> {} impl<S, Target> self::sealed::Sealed<(Target,)> for S where S: Service<Target> {}
impl<S, Target> MakeConnection<Target> for S impl<S, Target> MakeConnection<Target> for S
@ -20,12 +18,6 @@ where
type Connection = S::Response; type Connection = S::Response;
type Error = S::Error; type Error = S::Error;
type Future = S::Future; type Future = S::Future;
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>> {
loop {}
}
fn make_connection(&mut self, target: Target) -> Self::Future {
loop {}
}
} }
pub trait MakeServiceRef<Target, ReqBody> { pub trait MakeServiceRef<Target, ReqBody> {
type ResBody; type ResBody;