blob: 444a4e6957fad478d5372d242803b8c16c91805e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#![feature(impl_trait_in_assoc_type)]
// edition:2018
use std::future::Future;
pub trait Service<Request> {
type Future: Future<Output = ()>;
fn call(&mut self, req: Request) -> Self::Future;
}
// NOTE: the pub(crate) here is critical
pub(crate) fn new() -> () {}
pub struct A;
impl Service<()> for A {
type Future = impl Future<Output = ()>;
fn call(&mut self, _: ()) -> Self::Future {
async { new() }
}
}
|