Skip to main content

ferrite_session/internal/base/protocol/
impls.rs

1use core::{
2  future::Future,
3  pin::Pin,
4};
5
6use super::{
7  traits::*,
8  types::*,
9};
10use crate::internal::functional::{
11  nat::*,
12  type_app::{
13    TyCon,
14    TypeApp,
15  },
16};
17
18impl TyCon for ProviderEndpointF {}
19
20impl TyCon for ClientEndpointF {}
21
22impl<'a, A: Protocol> TypeApp<'a, A> for ProviderEndpointF
23{
24  type Applied = A::ProviderEndpoint;
25}
26
27impl<'a, A: Protocol> TypeApp<'a, A> for ClientEndpointF
28{
29  type Applied = A::ClientEndpoint;
30}
31
32impl SealedProtocol for Z {}
33
34impl Protocol for Z
35{
36  type ClientEndpoint = ();
37  type ProviderEndpoint = ();
38
39  fn create_endpoints() -> (Self::ProviderEndpoint, Self::ClientEndpoint)
40  {
41    ((), ())
42  }
43
44  fn forward(
45    _client_end: Self::ClientEndpoint,
46    _provider_end: Self::ProviderEndpoint,
47  ) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>
48  {
49    Box::pin(async {})
50  }
51}
52
53impl<N> SealedProtocol for S<N> {}
54
55impl<N> Protocol for S<N>
56where
57  N: Protocol,
58{
59  type ClientEndpoint = ();
60  type ProviderEndpoint = ();
61
62  fn create_endpoints() -> (Self::ProviderEndpoint, Self::ClientEndpoint)
63  {
64    ((), ())
65  }
66
67  fn forward(
68    _client_end: Self::ClientEndpoint,
69    _provider_end: Self::ProviderEndpoint,
70  ) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>
71  {
72    Box::pin(async {})
73  }
74}