ferrite_session/internal/session/shared/
release.rs

1use crate::internal::{
2  base::*,
3  protocol::{
4    LinearToShared,
5    SharedToLinear,
6  },
7};
8
9pub fn release_shared_session<N, C1, C2, A, B>(
10  _n: N,
11  cont: PartialSession<C2, B>,
12) -> PartialSession<C1, B>
13where
14  A: Protocol,
15  B: Protocol,
16  C1: Context,
17  C2: Context,
18  A: SharedRecApp<SharedToLinear<LinearToShared<A>>>,
19  N: ContextLens<C1, SharedToLinear<LinearToShared<A>>, Empty, Target = C2>,
20{
21  unsafe_create_session(move |ctx1, provider_end_b| async move {
22    let (endpoint, ctx2) = N::extract_source(ctx1);
23
24    let lock_sender = endpoint.get_applied();
25
26    let ctx3 = N::insert_target((), ctx2);
27
28    lock_sender.send(()).unwrap();
29
30    unsafe_run_session(cont, ctx3, provider_end_b).await;
31  })
32}