#![allow(clippy::type_complexity, clippy::too_many_arguments, clippy::large_enum_variant)] use mpstthree::binary::struct_trait::{end::End, recv::Recv, send::Send, session::Session}; use mpstthree::role::broadcast::RoleBroadcast; use mpstthree::role::end::RoleEnd; use mpstthree::{ bundle_struct_fork_close_multi_cancel, create_fn_choose_mpst_multi_to_all_bundle, create_multiple_normal_role_short, create_recv_mpst_session_bundle, create_send_mpst_cancel_bundle, offer_mpst, create_multiple_normal_name_short }; use std::error::Error; // Create the new MeshedChannels for twenty participants and the close and fork functions bundle_struct_fork_close_multi_cancel!(close_mpst_multi, fork_mpst, MeshedChannels, 20); // Create new roles // normal create_multiple_normal_role_short!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T); // Create new names create_multiple_normal_name_short!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T); // Create new send functions // A create_send_mpst_cancel_bundle!( send_mpst_a_to_b, RoleB, 1 | => NameA, MeshedChannels, 20 ); // B create_send_mpst_cancel_bundle!( send_mpst_b_to_a, RoleA, 1 | send_mpst_b_to_c, RoleC, 2 | => NameB, MeshedChannels, 20 ); // C create_send_mpst_cancel_bundle!( send_mpst_c_to_b, RoleB, 2 | send_mpst_c_to_d, RoleD, 3 | => NameC, MeshedChannels, 20 ); // D create_send_mpst_cancel_bundle!( send_mpst_d_to_c, RoleC, 3 | send_mpst_d_to_e, RoleE, 4 | => NameD, MeshedChannels, 20 ); // E create_send_mpst_cancel_bundle!( send_mpst_e_to_d, RoleD, 4 | send_mpst_e_to_f, RoleF, 5 | => NameE, MeshedChannels, 20 ); // F create_send_mpst_cancel_bundle!( send_mpst_f_to_e, RoleE, 5 | send_mpst_f_to_g, RoleG, 6 | => NameF, MeshedChannels, 20 ); // G create_send_mpst_cancel_bundle!( send_mpst_g_to_f, RoleF, 6 | send_mpst_g_to_h, RoleH, 7 | => NameG, MeshedChannels, 20 ); // H create_send_mpst_cancel_bundle!( send_mpst_h_to_g, RoleG, 7 | send_mpst_h_to_i, RoleI, 8 | => NameH, MeshedChannels, 20 ); // I create_send_mpst_cancel_bundle!( send_mpst_i_to_h, RoleH, 8 | send_mpst_i_to_j, RoleJ, 9 | => NameI, MeshedChannels, 20 ); // J create_send_mpst_cancel_bundle!( send_mpst_j_to_i, RoleI, 9 | send_mpst_j_to_k, RoleK, 10 | => NameJ, MeshedChannels, 20 ); // K create_send_mpst_cancel_bundle!( send_mpst_k_to_j, RoleJ, 10 | send_mpst_k_to_l, RoleL, 11 | => NameK, MeshedChannels, 20 ); // L create_send_mpst_cancel_bundle!( send_mpst_l_to_k, RoleK, 11 | send_mpst_l_to_m, RoleM, 12 | => NameL, MeshedChannels, 20 ); // M create_send_mpst_cancel_bundle!( send_mpst_m_to_l, RoleL, 12 | send_mpst_m_to_n, RoleN, 13 | => NameM, MeshedChannels, 20 ); // N create_send_mpst_cancel_bundle!( send_mpst_n_to_m, RoleM, 13 | send_mpst_n_to_o, RoleO, 14 | => NameN, MeshedChannels, 20 ); // O create_send_mpst_cancel_bundle!( send_mpst_o_to_n, RoleN, 14 | send_mpst_o_to_p, RoleP, 15 | => NameO, MeshedChannels, 20 ); // P create_send_mpst_cancel_bundle!( send_mpst_p_to_o, RoleO, 15 | send_mpst_p_to_q, RoleQ, 16 | => NameP, MeshedChannels, 20 ); // Q create_send_mpst_cancel_bundle!( send_mpst_q_to_p, RoleP, 16 | send_mpst_q_to_r, RoleR, 17 | => NameQ, MeshedChannels, 20 ); // R create_send_mpst_cancel_bundle!( send_mpst_r_to_q, RoleQ, 17 | send_mpst_r_to_s, RoleS, 18 | => NameR, MeshedChannels, 20 ); // S create_send_mpst_cancel_bundle!( send_mpst_s_to_r, RoleR, 18 | send_mpst_s_to_t, RoleT, 19 | => NameS, MeshedChannels, 20 ); // T create_send_mpst_cancel_bundle!( send_mpst_t_to_s, RoleS, 19 | => NameT, MeshedChannels, 20 ); // Create new recv functions and related types // A create_recv_mpst_session_bundle!( recv_mpst_a_from_b, RoleB, 1 | recv_mpst_a_from_t, RoleT, 19 | => NameA, MeshedChannels, 20 ); // B create_recv_mpst_session_bundle!( recv_mpst_b_from_a, RoleA, 1 | recv_mpst_b_from_c, RoleC, 2 | recv_mpst_b_from_t, RoleT, 19 | => NameB, MeshedChannels, 20 ); // C create_recv_mpst_session_bundle!( recv_mpst_c_from_b, RoleB, 2 | recv_mpst_c_from_d, RoleD, 3 | recv_mpst_c_from_t, RoleT, 19 | => NameC, MeshedChannels, 20 ); // D create_recv_mpst_session_bundle!( recv_mpst_d_from_c, RoleC, 3 | recv_mpst_d_from_e, RoleE, 4 | recv_mpst_d_from_t, RoleT, 19 | => NameD, MeshedChannels, 20 ); // E create_recv_mpst_session_bundle!( recv_mpst_e_from_d, RoleD, 4 | recv_mpst_e_from_f, RoleF, 5 | recv_mpst_e_from_t, RoleT, 19 | => NameE, MeshedChannels, 20 ); // F create_recv_mpst_session_bundle!( recv_mpst_f_from_e, RoleE, 5 | recv_mpst_f_from_g, RoleG, 6 | recv_mpst_f_from_t, RoleT, 19 | => NameF, MeshedChannels, 20 ); // G create_recv_mpst_session_bundle!( recv_mpst_g_from_f, RoleF, 6 | recv_mpst_g_from_h, RoleH, 7 | recv_mpst_g_from_t, RoleT, 19 | => NameG, MeshedChannels, 20 ); // H create_recv_mpst_session_bundle!( recv_mpst_h_from_g, RoleG, 7 | recv_mpst_h_from_i, RoleI, 8 | recv_mpst_h_from_t, RoleT, 19 | => NameH, MeshedChannels, 20 ); // I create_recv_mpst_session_bundle!( recv_mpst_i_from_h, RoleH, 8 | recv_mpst_i_from_j, RoleJ, 9 | recv_mpst_i_from_t, RoleT, 19 | => NameI, MeshedChannels, 20 ); // J create_recv_mpst_session_bundle!( recv_mpst_j_from_i, RoleI, 9 | recv_mpst_j_from_k, RoleK, 10 | recv_mpst_j_from_t, RoleT, 19 | => NameJ, MeshedChannels, 20 ); // K create_recv_mpst_session_bundle!( recv_mpst_k_from_j, RoleJ, 10 | recv_mpst_k_from_l, RoleL, 11 | recv_mpst_k_from_t, RoleT, 19 | => NameK, MeshedChannels, 20 ); // L create_recv_mpst_session_bundle!( recv_mpst_l_from_k, RoleK, 11 | recv_mpst_l_from_m, RoleM, 12 | recv_mpst_l_from_t, RoleT, 19 | => NameL, MeshedChannels, 20 ); // M create_recv_mpst_session_bundle!( recv_mpst_m_from_l, RoleL, 12 | recv_mpst_m_from_n, RoleN, 13 | recv_mpst_m_from_t, RoleT, 19 | => NameM, MeshedChannels, 20 ); // N create_recv_mpst_session_bundle!( recv_mpst_n_from_m, RoleM, 13 | recv_mpst_n_from_o, RoleO, 14 | recv_mpst_n_from_t, RoleT, 19 | => NameN, MeshedChannels, 20 ); // O create_recv_mpst_session_bundle!( recv_mpst_o_from_n, RoleN, 14 | recv_mpst_o_from_p, RoleP, 15 | recv_mpst_o_from_t, RoleT, 19 | => NameO, MeshedChannels, 20 ); // P create_recv_mpst_session_bundle!( recv_mpst_p_from_o, RoleO, 15 | recv_mpst_p_from_q, RoleQ, 16 | recv_mpst_p_from_t, RoleT, 19 | => NameP, MeshedChannels, 20 ); // Q create_recv_mpst_session_bundle!( recv_mpst_q_from_p, RoleP, 16 | recv_mpst_q_from_r, RoleR, 17 | recv_mpst_q_from_t, RoleT, 19 | => NameQ, MeshedChannels, 20 ); // R create_recv_mpst_session_bundle!( recv_mpst_r_from_q, RoleQ, 17 | recv_mpst_r_from_s, RoleS, 18 | recv_mpst_r_from_t, RoleT, 19 | => NameR, MeshedChannels, 20 ); // S create_recv_mpst_session_bundle!( recv_mpst_s_from_r, RoleR, 18 | recv_mpst_s_from_t, RoleT, 19 | => NameS, MeshedChannels, 20 ); // T create_recv_mpst_session_bundle!( recv_mpst_t_from_s, RoleS, 19 | => NameT, MeshedChannels, 20 ); // Types // A enum Branching0fromTtoA { Forward( MeshedChannels< Send<(), End>, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursAtoT, RoleB>, NameA, >, ), Backward( MeshedChannels< Recv<(), End>, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursAtoT, RoleB>, NameA, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameA, >, ), } type RecursAtoT = ::Dual; // B enum Branching0fromTtoB { Forward( MeshedChannels< Recv<(), End>, Send<(), End>, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursBtoT, RoleA>>, NameB, >, ), Backward( MeshedChannels< Send<(), End>, Recv<(), End>, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursBtoT, RoleC>>, NameB, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameB, >, ), } type RecursBtoT = ::Dual; // C enum Branching0fromTtoC { Forward( MeshedChannels< End, Recv<(), End>, Send<(), End>, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursCtoT, RoleB>>, NameC, >, ), Backward( MeshedChannels< End, Send<(), End>, Recv<(), End>, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursCtoT, RoleD>>, NameC, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameC, >, ), } type RecursCtoT = ::Dual; // D enum Branching0fromTtoD { Forward( MeshedChannels< End, End, Recv<(), End>, Send<(), End>, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursDtoT, RoleC>>, NameD, >, ), Backward( MeshedChannels< End, End, Send<(), End>, Recv<(), End>, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursDtoT, RoleE>>, NameD, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameD, >, ), } type RecursDtoT = ::Dual; // E enum Branching0fromTtoE { Forward( MeshedChannels< End, End, End, Recv<(), End>, Send<(), End>, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursEtoT, RoleD>>, NameE, >, ), Backward( MeshedChannels< End, End, End, Send<(), End>, Recv<(), End>, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursEtoT, RoleF>>, NameE, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameE, >, ), } type RecursEtoT = ::Dual; // F enum Branching0fromTtoF { Forward( MeshedChannels< End, End, End, End, Recv<(), End>, Send<(), End>, End, End, End, End, End, End, End, End, End, End, End, End, RecursFtoT, RoleE>>, NameF, >, ), Backward( MeshedChannels< End, End, End, End, Send<(), End>, Recv<(), End>, End, End, End, End, End, End, End, End, End, End, End, End, RecursFtoT, RoleG>>, NameF, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameF, >, ), } type RecursFtoT = ::Dual; // G enum Branching0fromTtoG { Forward( MeshedChannels< End, End, End, End, End, Recv<(), End>, Send<(), End>, End, End, End, End, End, End, End, End, End, End, End, RecursGtoT, RoleF>>, NameG, >, ), Backward( MeshedChannels< End, End, End, End, End, Send<(), End>, Recv<(), End>, End, End, End, End, End, End, End, End, End, End, End, RecursGtoT, RoleH>>, NameG, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameG, >, ), } type RecursGtoT = ::Dual; // H enum Branching0fromTtoH { Forward( MeshedChannels< End, End, End, End, End, End, Recv<(), End>, Send<(), End>, End, End, End, End, End, End, End, End, End, End, RecursHtoT, RoleG>>, NameH, >, ), Backward( MeshedChannels< End, End, End, End, End, End, Send<(), End>, Recv<(), End>, End, End, End, End, End, End, End, End, End, End, RecursHtoT, RoleI>>, NameH, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameH, >, ), } type RecursHtoT = ::Dual; // I enum Branching0fromTtoI { Forward( MeshedChannels< End, End, End, End, End, End, End, Recv<(), End>, Send<(), End>, End, End, End, End, End, End, End, End, End, RecursItoT, RoleH>>, NameI, >, ), Backward( MeshedChannels< End, End, End, End, End, End, End, Send<(), End>, Recv<(), End>, End, End, End, End, End, End, End, End, End, RecursItoT, RoleJ>>, NameI, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameI, >, ), } type RecursItoT = ::Dual; // J enum Branching0fromTtoJ { Forward( MeshedChannels< End, End, End, End, End, End, End, End, Recv<(), End>, Send<(), End>, End, End, End, End, End, End, End, End, RecursJtoT, RoleI>>, NameJ, >, ), Backward( MeshedChannels< End, End, End, End, End, End, End, End, Send<(), End>, Recv<(), End>, End, End, End, End, End, End, End, End, RecursJtoT, RoleK>>, NameJ, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameJ, >, ), } type RecursJtoT = ::Dual; // K enum Branching0fromTtoK { Forward( MeshedChannels< End, End, End, End, End, End, End, End, End, Recv<(), End>, Send<(), End>, End, End, End, End, End, End, End, RecursKtoT, RoleJ>>, NameK, >, ), Backward( MeshedChannels< End, End, End, End, End, End, End, End, End, Send<(), End>, Recv<(), End>, End, End, End, End, End, End, End, RecursKtoT, RoleL>>, NameK, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameK, >, ), } type RecursKtoT = ::Dual; // L enum Branching0fromTtoL { Forward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, Recv<(), End>, Send<(), End>, End, End, End, End, End, End, RecursLtoT, RoleK>>, NameL, >, ), Backward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, Send<(), End>, Recv<(), End>, End, End, End, End, End, End, RecursLtoT, RoleM>>, NameL, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameL, >, ), } type RecursLtoT = ::Dual; // M enum Branching0fromTtoM { Forward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, Recv<(), End>, Send<(), End>, End, End, End, End, End, RecursMtoT, RoleL>>, NameM, >, ), Backward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, Send<(), End>, Recv<(), End>, End, End, End, End, End, RecursMtoT, RoleN>>, NameM, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameM, >, ), } type RecursMtoT = ::Dual; // N enum Branching0fromTtoN { Forward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, Recv<(), End>, Send<(), End>, End, End, End, End, RecursNtoT, RoleM>>, NameN, >, ), Backward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, Send<(), End>, Recv<(), End>, End, End, End, End, RecursNtoT, RoleO>>, NameN, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameN, >, ), } type RecursNtoT = ::Dual; // O enum Branching0fromTtoO { Forward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, Recv<(), End>, Send<(), End>, End, End, End, RecursOtoT, RoleN>>, NameO, >, ), Backward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, Send<(), End>, Recv<(), End>, End, End, End, RecursOtoT, RoleP>>, NameO, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameO, >, ), } type RecursOtoT = ::Dual; // P enum Branching0fromTtoP { Forward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, Recv<(), End>, Send<(), End>, End, End, RecursPtoT, RoleO>>, NameP, >, ), Backward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, Send<(), End>, Recv<(), End>, End, End, RecursPtoT, RoleQ>>, NameP, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameP, >, ), } type RecursPtoT = ::Dual; // Q enum Branching0fromTtoQ { Forward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, Recv<(), End>, Send<(), End>, End, RecursQtoT, RoleP>>, NameQ, >, ), Backward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, Send<(), End>, Recv<(), End>, End, RecursQtoT, RoleR>>, NameQ, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameQ, >, ), } type RecursQtoT = ::Dual; // R enum Branching0fromTtoR { Forward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, Recv<(), End>, Send<(), End>, RecursRtoT, RoleQ>>, NameR, >, ), Backward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, Send<(), End>, Recv<(), End>, RecursRtoT, RoleS>>, NameR, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameR, >, ), } type RecursRtoT = ::Dual; // S enum Branching0fromTtoS { Forward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, Recv<(), End>, Send<(), RecursStoT>, RoleR>>, NameS, >, ), Backward( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, Send<(), End>, Recv<(), RecursStoT>, RoleT>>, NameS, >, ), Done( MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameS, >, ), } type RecursStoT = ::Dual; // T type Choose0fromTtoA = Send; type Choose0fromTtoB = Send; type Choose0fromTtoC = Send; type Choose0fromTtoD = Send; type Choose0fromTtoE = Send; type Choose0fromTtoF = Send; type Choose0fromTtoG = Send; type Choose0fromTtoH = Send; type Choose0fromTtoI = Send; type Choose0fromTtoJ = Send; type Choose0fromTtoK = Send; type Choose0fromTtoL = Send; type Choose0fromTtoM = Send; type Choose0fromTtoN = Send; type Choose0fromTtoO = Send; type Choose0fromTtoP = Send; type Choose0fromTtoQ = Send; type Choose0fromTtoR = Send; type Choose0fromTtoS = Send; type EndpointDoneT = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RoleEnd, NameT, >; type EndpointForwardT = MeshedChannels< Choose0fromTtoA, Choose0fromTtoB, Choose0fromTtoC, Choose0fromTtoD, Choose0fromTtoE, Choose0fromTtoF, Choose0fromTtoG, Choose0fromTtoH, Choose0fromTtoI, Choose0fromTtoJ, Choose0fromTtoK, Choose0fromTtoL, Choose0fromTtoM, Choose0fromTtoN, Choose0fromTtoO, Choose0fromTtoP, Choose0fromTtoQ, Choose0fromTtoR, Recv<(), Choose0fromTtoS>, RoleS, NameT, >; type EndpointBackwardT = MeshedChannels< Choose0fromTtoA, Choose0fromTtoB, Choose0fromTtoC, Choose0fromTtoD, Choose0fromTtoE, Choose0fromTtoF, Choose0fromTtoG, Choose0fromTtoH, Choose0fromTtoI, Choose0fromTtoJ, Choose0fromTtoK, Choose0fromTtoL, Choose0fromTtoM, Choose0fromTtoN, Choose0fromTtoO, Choose0fromTtoP, Choose0fromTtoQ, Choose0fromTtoR, Send<(), Choose0fromTtoS>, RoleS, NameT, >; // Creating the MP sessions type EndpointA = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursAtoT, RoleT, NameA, >; type EndpointB = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursBtoT, RoleT, NameB, >; type EndpointC = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursCtoT, RoleT, NameC, >; type EndpointD = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursDtoT, RoleT, NameD, >; type EndpointE = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursEtoT, RoleT, NameE, >; type EndpointF = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursFtoT, RoleT, NameF, >; type EndpointG = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursGtoT, RoleT, NameG, >; type EndpointH = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursHtoT, RoleT, NameH, >; type EndpointI = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursItoT, RoleT, NameI, >; type EndpointJ = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursJtoT, RoleT, NameJ, >; type EndpointK = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursKtoT, RoleT, NameK, >; type EndpointL = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursLtoT, RoleT, NameL, >; type EndpointM = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursMtoT, RoleT, NameM, >; type EndpointN = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursNtoT, RoleT, NameN, >; type EndpointO = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursOtoT, RoleT, NameO, >; type EndpointP = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursPtoT, RoleT, NameP, >; type EndpointQ = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursQtoT, RoleT, NameQ, >; type EndpointR = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursRtoT, RoleT, NameR, >; type EndpointS = MeshedChannels< End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, End, RecursStoT, RoleT, NameS, >; type EndpointT = MeshedChannels< Choose0fromTtoA, Choose0fromTtoB, Choose0fromTtoC, Choose0fromTtoD, Choose0fromTtoE, Choose0fromTtoF, Choose0fromTtoG, Choose0fromTtoH, Choose0fromTtoI, Choose0fromTtoJ, Choose0fromTtoK, Choose0fromTtoL, Choose0fromTtoM, Choose0fromTtoN, Choose0fromTtoO, Choose0fromTtoP, Choose0fromTtoQ, Choose0fromTtoR, Choose0fromTtoS, RoleBroadcast, NameT, >; create_fn_choose_mpst_multi_to_all_bundle!( done_from_t_to_all, forward_from_t_to_all, backward_from_t_to_all, => Done, Forward, Backward, => EndpointDoneT, EndpointForwardT, EndpointBackwardT, => Branching0fromTtoA, Branching0fromTtoB, Branching0fromTtoC, Branching0fromTtoD, Branching0fromTtoE, Branching0fromTtoF, Branching0fromTtoG, Branching0fromTtoH, Branching0fromTtoI, Branching0fromTtoJ, Branching0fromTtoK, Branching0fromTtoL, Branching0fromTtoM, Branching0fromTtoN, Branching0fromTtoO, Branching0fromTtoP, Branching0fromTtoQ, Branching0fromTtoR, Branching0fromTtoS, => NameA, NameB, NameC, NameD, NameE, NameF, NameG, NameH, NameI, NameJ, NameK, NameL, NameM, NameN, NameO, NameP, NameQ, NameR, NameS, => NameT, MeshedChannels, 20 ); fn endpoint_a(s: EndpointA) -> Result<(), Box> { offer_mpst!(s, recv_mpst_a_from_t, { Branching0fromTtoA::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoA::Forward(s) => { let s = send_mpst_a_to_b((), s)?; endpoint_a(s) }, Branching0fromTtoA::Backward(s) => { let (_, s) = recv_mpst_a_from_b(s)?; endpoint_a(s) }, }) } fn endpoint_b(s: EndpointB) -> Result<(), Box> { offer_mpst!(s, recv_mpst_b_from_t, { Branching0fromTtoB::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoB::Forward(s) => { let ((), s) = recv_mpst_b_from_a(s)?; let s = send_mpst_b_to_c((), s)?; endpoint_b(s) }, Branching0fromTtoB::Backward(s) => { let ((), s) = recv_mpst_b_from_c(s)?; let s = send_mpst_b_to_a((), s)?; endpoint_b(s) }, }) } fn endpoint_c(s: EndpointC) -> Result<(), Box> { offer_mpst!(s, recv_mpst_c_from_t, { Branching0fromTtoC::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoC::Forward(s) => { let ((), s) = recv_mpst_c_from_b(s)?; let s = send_mpst_c_to_d((), s)?; endpoint_c(s) }, Branching0fromTtoC::Backward(s) => { let ((), s) = recv_mpst_c_from_d(s)?; let s = send_mpst_c_to_b((), s)?; endpoint_c(s) }, }) } fn endpoint_d(s: EndpointD) -> Result<(), Box> { offer_mpst!(s, recv_mpst_d_from_t, { Branching0fromTtoD::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoD::Forward(s) => { let ((), s) = recv_mpst_d_from_c(s)?; let s = send_mpst_d_to_e((), s)?; endpoint_d(s) }, Branching0fromTtoD::Backward(s) => { let ((), s) = recv_mpst_d_from_e(s)?; let s = send_mpst_d_to_c((), s)?; endpoint_d(s) }, }) } fn endpoint_e(s: EndpointE) -> Result<(), Box> { offer_mpst!(s, recv_mpst_e_from_t, { Branching0fromTtoE::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoE::Forward(s) => { let ((), s) = recv_mpst_e_from_d(s)?; let s = send_mpst_e_to_f((), s)?; endpoint_e(s) }, Branching0fromTtoE::Backward(s) => { let ((), s) = recv_mpst_e_from_f(s)?; let s = send_mpst_e_to_d((), s)?; endpoint_e(s) }, }) } fn endpoint_f(s: EndpointF) -> Result<(), Box> { offer_mpst!(s, recv_mpst_f_from_t, { Branching0fromTtoF::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoF::Forward(s) => { let ((), s) = recv_mpst_f_from_e(s)?; let s = send_mpst_f_to_g((), s)?; endpoint_f(s) }, Branching0fromTtoF::Backward(s) => { let ((), s) = recv_mpst_f_from_g(s)?; let s = send_mpst_f_to_e((), s)?; endpoint_f(s) }, }) } fn endpoint_g(s: EndpointG) -> Result<(), Box> { offer_mpst!(s, recv_mpst_g_from_t, { Branching0fromTtoG::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoG::Forward(s) => { let ((), s) = recv_mpst_g_from_f(s)?; let s = send_mpst_g_to_h((), s)?; endpoint_g(s) }, Branching0fromTtoG::Backward(s) => { let ((), s) = recv_mpst_g_from_h(s)?; let s = send_mpst_g_to_f((), s)?; endpoint_g(s) }, }) } fn endpoint_h(s: EndpointH) -> Result<(), Box> { offer_mpst!(s, recv_mpst_h_from_t, { Branching0fromTtoH::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoH::Forward(s) => { let ((), s) = recv_mpst_h_from_g(s)?; let s = send_mpst_h_to_i((), s)?; endpoint_h(s) }, Branching0fromTtoH::Backward(s) => { let ((), s) = recv_mpst_h_from_i(s)?; let s = send_mpst_h_to_g((), s)?; endpoint_h(s) }, }) } fn endpoint_i(s: EndpointI) -> Result<(), Box> { offer_mpst!(s, recv_mpst_i_from_t, { Branching0fromTtoI::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoI::Forward(s) => { let ((), s) = recv_mpst_i_from_h(s)?; let s = send_mpst_i_to_j((), s)?; endpoint_i(s) }, Branching0fromTtoI::Backward(s) => { let ((), s) = recv_mpst_i_from_j(s)?; let s = send_mpst_i_to_h((), s)?; endpoint_i(s) }, }) } fn endpoint_j(s: EndpointJ) -> Result<(), Box> { offer_mpst!(s, recv_mpst_j_from_t, { Branching0fromTtoJ::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoJ::Forward(s) => { let ((), s) = recv_mpst_j_from_i(s)?; let s = send_mpst_j_to_k((), s)?; endpoint_j(s) }, Branching0fromTtoJ::Backward(s) => { let ((), s) = recv_mpst_j_from_k(s)?; let s = send_mpst_j_to_i((), s)?; endpoint_j(s) }, }) } fn endpoint_k(s: EndpointK) -> Result<(), Box> { offer_mpst!(s, recv_mpst_k_from_t, { Branching0fromTtoK::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoK::Forward(s) => { let ((), s) = recv_mpst_k_from_j(s)?; let s = send_mpst_k_to_l((), s)?; endpoint_k(s) }, Branching0fromTtoK::Backward(s) => { let ((), s) = recv_mpst_k_from_l(s)?; let s = send_mpst_k_to_j((), s)?; endpoint_k(s) }, }) } fn endpoint_l(s: EndpointL) -> Result<(), Box> { offer_mpst!(s, recv_mpst_l_from_t, { Branching0fromTtoL::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoL::Forward(s) => { let ((), s) = recv_mpst_l_from_k(s)?; let s = send_mpst_l_to_m((), s)?; endpoint_l(s) }, Branching0fromTtoL::Backward(s) => { let ((), s) = recv_mpst_l_from_m(s)?; let s = send_mpst_l_to_k((), s)?; endpoint_l(s) }, }) } fn endpoint_m(s: EndpointM) -> Result<(), Box> { offer_mpst!(s, recv_mpst_m_from_t, { Branching0fromTtoM::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoM::Forward(s) => { let ((), s) = recv_mpst_m_from_l(s)?; let s = send_mpst_m_to_n((), s)?; endpoint_m(s) }, Branching0fromTtoM::Backward(s) => { let ((), s) = recv_mpst_m_from_n(s)?; let s = send_mpst_m_to_l((), s)?; endpoint_m(s) }, }) } fn endpoint_n(s: EndpointN) -> Result<(), Box> { offer_mpst!(s, recv_mpst_n_from_t, { Branching0fromTtoN::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoN::Forward(s) => { let ((), s) = recv_mpst_n_from_m(s)?; let s = send_mpst_n_to_o((), s)?; endpoint_n(s) }, Branching0fromTtoN::Backward(s) => { let ((), s) = recv_mpst_n_from_o(s)?; let s = send_mpst_n_to_m((), s)?; endpoint_n(s) }, }) } fn endpoint_o(s: EndpointO) -> Result<(), Box> { offer_mpst!(s, recv_mpst_o_from_t, { Branching0fromTtoO::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoO::Forward(s) => { let ((), s) = recv_mpst_o_from_n(s)?; let s = send_mpst_o_to_p((), s)?; endpoint_o(s) }, Branching0fromTtoO::Backward(s) => { let ((), s) = recv_mpst_o_from_p(s)?; let s = send_mpst_o_to_n((), s)?; endpoint_o(s) }, }) } fn endpoint_p(s: EndpointP) -> Result<(), Box> { offer_mpst!(s, recv_mpst_p_from_t, { Branching0fromTtoP::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoP::Forward(s) => { let ((), s) = recv_mpst_p_from_o(s)?; let s = send_mpst_p_to_q((), s)?; endpoint_p(s) }, Branching0fromTtoP::Backward(s) => { let ((), s) = recv_mpst_p_from_q(s)?; let s = send_mpst_p_to_o((), s)?; endpoint_p(s) }, }) } fn endpoint_q(s: EndpointQ) -> Result<(), Box> { offer_mpst!(s, recv_mpst_q_from_t, { Branching0fromTtoQ::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoQ::Forward(s) => { let ((), s) = recv_mpst_q_from_p(s)?; let s = send_mpst_q_to_r((), s)?; endpoint_q(s) }, Branching0fromTtoQ::Backward(s) => { let ((), s) = recv_mpst_q_from_r(s)?; let s = send_mpst_q_to_p((), s)?; endpoint_q(s) }, }) } fn endpoint_r(s: EndpointR) -> Result<(), Box> { offer_mpst!(s, recv_mpst_r_from_t, { Branching0fromTtoR::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoR::Forward(s) => { let ((), s) = recv_mpst_r_from_q(s)?; let s = send_mpst_r_to_s((), s)?; endpoint_r(s) }, Branching0fromTtoR::Backward(s) => { let ((), s) = recv_mpst_r_from_s(s)?; let s = send_mpst_r_to_q((), s)?; endpoint_r(s) }, }) } fn endpoint_s(s: EndpointS) -> Result<(), Box> { offer_mpst!(s, recv_mpst_s_from_t, { Branching0fromTtoS::Done(s) => { close_mpst_multi(s) }, Branching0fromTtoS::Forward(s) => { let ((), s) = recv_mpst_s_from_r(s)?; let s = send_mpst_s_to_t((), s)?; endpoint_s(s) }, Branching0fromTtoS::Backward(s) => { let ((), s) = recv_mpst_s_from_t(s)?; let s = send_mpst_s_to_r((), s)?; endpoint_s(s) }, }) } fn endpoint_t(s: EndpointT) -> Result<(), Box> { recurs_t(s, 100) } fn recurs_t(s: EndpointT, index: i64) -> Result<(), Box> { match index { 0 => { let s = done_from_t_to_all(s); close_mpst_multi(s) } i if i % 2 == 0 => { let s = forward_from_t_to_all(s); let (_, s) = recv_mpst_t_from_s(s)?; recurs_t(s, i - 1) } i => { let s = backward_from_t_to_all(s); let s = send_mpst_t_to_s((), s)?; recurs_t(s, i - 1) } } } fn main() { let ( thread_a, thread_b, thread_c, thread_d, thread_e, thread_f, thread_g, thread_h, thread_i, thread_j, thread_k, thread_l, thread_m, thread_n, thread_o, thread_p, thread_q, thread_r, thread_s, thread_t, ) = fork_mpst( endpoint_a, endpoint_b, endpoint_c, endpoint_d, endpoint_e, endpoint_f, endpoint_g, endpoint_h, endpoint_i, endpoint_j, endpoint_k, endpoint_l, endpoint_m, endpoint_n, endpoint_o, endpoint_p, endpoint_q, endpoint_r, endpoint_s, endpoint_t, ); thread_a.join().unwrap(); thread_b.join().unwrap(); thread_c.join().unwrap(); thread_d.join().unwrap(); thread_e.join().unwrap(); thread_f.join().unwrap(); thread_g.join().unwrap(); thread_h.join().unwrap(); thread_i.join().unwrap(); thread_j.join().unwrap(); thread_k.join().unwrap(); thread_l.join().unwrap(); thread_m.join().unwrap(); thread_n.join().unwrap(); thread_o.join().unwrap(); thread_p.join().unwrap(); thread_q.join().unwrap(); thread_r.join().unwrap(); thread_s.join().unwrap(); thread_t.join().unwrap(); }