Skip to content

Commit e3cba47

Browse files
committed
fix: working on better acceptor abstraction
1 parent 2e8d6e1 commit e3cba47

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/api/tls.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,27 @@ where
3939
})
4040
}
4141

42+
trait Func: Fn() -> <Self as Func>::Output {
43+
type Output;
44+
}
45+
46+
impl<F, O> Func for F
47+
where
48+
F: Fn() -> O,
49+
{
50+
type Output = O;
51+
}
52+
53+
fn _test<F: CertFacade>(_facade: F) -> impl Func<Output = impl Future<Output = ()>> + Clone {
54+
let test = Arc::new("Hallo".to_owned());
55+
move || {
56+
let test_two = Arc::clone(&test);
57+
async move {
58+
println!("{}", test_two);
59+
}
60+
}
61+
}
62+
4263
struct Acceptor<F> {
4364
facade: F,
4465
config: RwLock<(Option<Cert>, Arc<ServerConfig>)>,

0 commit comments

Comments
 (0)