1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

use crate::base::{
  Protocol,
  Empty,
  Context,
  EmptyContext,
  ContextLens,
  PartialSession,
  unsafe_create_session,
};

pub fn forward
  < N, C, A >
  (_ : N)
  ->
    PartialSession <
      C,
      A
    >
where
  A : Protocol,
  C : Context,
  N :: Target : EmptyContext,
  N :
    ContextLens <
      C,
      A,
      Empty
    >
{
  unsafe_create_session (
    move | ctx, sender | async move {
      let (receiver, _) = N :: extract_source ( ctx );

      let val = receiver.recv().await.unwrap();
      sender.send( val ).await;
    })
}