mirror of
https://github.com/Noratrieb/101844-repro.git
synced 2026-01-16 15:15:00 +01:00
more
This commit is contained in:
parent
0f642ee243
commit
8779d291ec
4 changed files with 20 additions and 43 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::sealed::Sealed;
|
use crate::Sealed;
|
||||||
use futures_core::TryStream;
|
use futures_core::TryStream;
|
||||||
use std::{
|
use std::{
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,10 @@
|
||||||
// #![allow(warnings)]
|
// #![allow(warnings)]
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
pub(crate) mod macros;
|
|
||||||
pub mod balance;
|
pub mod balance;
|
||||||
|
|
||||||
pub mod discover;
|
pub mod discover;
|
||||||
|
|
||||||
pub mod make;
|
pub mod make;
|
||||||
|
|
||||||
|
pub trait Sealed<T> {}
|
||||||
#[allow(unreachable_pub)]
|
|
||||||
mod sealed {
|
|
||||||
pub trait Sealed<T> {}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Alias for a type-erased error type.
|
/// Alias for a type-erased error type.
|
||||||
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
|
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
|
||||||
|
|
@ -24,7 +16,6 @@ mod load {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
macro_rules! opaque_future {
|
|
||||||
($(#[$m:meta])* pub type $name:ident<$($param:ident),+> = $actual:ty;) => {
|
|
||||||
$(#[$m])*
|
|
||||||
pub struct $name<$($param),+> {
|
|
||||||
inner: $actual
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
impl<$($param),+> $name<$($param),+> {
|
|
||||||
pub(crate) fn new(inner: $actual) -> Self {
|
|
||||||
Self {
|
|
||||||
inner
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<$($param),+> std::future::Future for $name<$($param),+>
|
|
||||||
where
|
|
||||||
$actual: std::future::Future,
|
|
||||||
{
|
|
||||||
type Output = <$actual as std::future::Future>::Output;
|
|
||||||
#[inline]
|
|
||||||
fn poll(self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>) -> std::task::Poll<Self::Output> {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
//! Trait aliases for Services that produce specific types of Responses.
|
//! Trait aliases for Services that produce specific types of Responses.
|
||||||
|
|
||||||
use crate::sealed::Sealed;
|
use crate::Sealed;
|
||||||
use crate::Service;
|
use crate::Service;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
|
|
||||||
|
|
@ -27,9 +27,23 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
opaque_future! {
|
pub struct SharedFuture<S> {
|
||||||
/// Response future from [`Shared`] services.
|
_s: S,
|
||||||
pub type SharedFuture<S> = futures_util::future::Ready<Result<S, Infallible>>;
|
}
|
||||||
|
|
||||||
|
impl<S> std::future::Future for SharedFuture<S>
|
||||||
|
where
|
||||||
|
futures_util::future::Ready<Result<S, Infallible>>: std::future::Future,
|
||||||
|
{
|
||||||
|
type Output =
|
||||||
|
<futures_util::future::Ready<Result<S, Infallible>> as std::future::Future>::Output;
|
||||||
|
|
||||||
|
fn poll(
|
||||||
|
self: std::pin::Pin<&mut Self>,
|
||||||
|
cx: &mut std::task::Context<'_>,
|
||||||
|
) -> std::task::Poll<Self::Output> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait MakeService<Target, Request> {
|
pub trait MakeService<Target, Request> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue