#![allow(dead_code, non_camel_case_types, unused_variables)] use mpstthree::binary::struct_trait::end::End; use mpstthree::binary_atmp::struct_trait::{recv::RecvTimed, send::SendTimed}; use mpstthree::generate_atmp; use mpstthree::role::end::RoleEnd; use std::collections::HashMap; use std::error::Error; use std::time::Instant; generate_atmp!(MeshedChannels, A, B, C); // Types of the payloads struct Payload; struct Stri; struct Integer; struct Test2 { payload: Integer } struct Test5 { payload: Payload } struct Test1; struct Test4 { payload: Payload } struct Test3 { payload: Stri } // Binary sessions in depth 0 // Binary sessions for C type Message_0_v_0_FromCToB = RecvTimed; type Message_0_v_1_FromCToB = End; type Message_0_v_0_FromCToA = End; // Binary sessions for B type Message_0_v_0_FromBToC = SendTimed; type Message_0_v_1_FromBToC = End; type Message_0_v_0_FromBToA = RecvTimed; type Message_0_v_1_FromBToA = RecvTimed; type Message_0_v_2_FromBToA = RecvTimed; type Message_0_v_3_FromBToA = RecvTimed; type Message_0_v_4_FromBToA = RecvTimed; type Message_0_v_5_FromBToA = RecvTimed; type Message_0_v_6_FromBToA = RecvTimed; type Message_0_v_7_FromBToA = End; // Binary sessions for A type Message_0_v_0_FromAToC = End; type Message_0_v_0_FromAToB = SendTimed; type Message_0_v_1_FromAToB = SendTimed; type Message_0_v_2_FromAToB = SendTimed; type Message_0_v_3_FromAToB = SendTimed; type Message_0_v_4_FromAToB = SendTimed; type Message_0_v_5_FromAToB = SendTimed; type Message_0_v_6_FromAToB = SendTimed; type Message_0_v_7_FromAToB = End; // Stacks in depth 0 // Stacks for B type Ordering_0_v_0_ForB = RoleA; type Ordering_0_v_1_ForB = RoleC; type Ordering_0_v_2_ForB = RoleA; type Ordering_0_v_3_ForB = RoleA; type Ordering_0_v_4_ForB = RoleA; type Ordering_0_v_5_ForB = RoleA; type Ordering_0_v_6_ForB = RoleA; type Ordering_0_v_7_ForB = RoleA; type Ordering_0_v_8_ForB = RoleEnd; // Stacks for C type Ordering_0_v_0_ForC = RoleB; type Ordering_0_v_1_ForC = RoleEnd; // Stacks for A type Ordering_0_v_0_ForA = RoleB; type Ordering_0_v_1_ForA = RoleB; type Ordering_0_v_2_ForA = RoleB; type Ordering_0_v_3_ForA = RoleB; type Ordering_0_v_4_ForA = RoleB; type Ordering_0_v_5_ForA = RoleB; type Ordering_0_v_6_ForA = RoleB; type Ordering_0_v_7_ForA = RoleEnd; // Endpoints in depth 0 // Endpoint for role A type Endpoint_0_ForA = MeshedChannels; // Endpoint for role B type Endpoint_0_ForB = MeshedChannels; // Endpoint for role C type Endpoint_0_ForC = MeshedChannels; // Fill in the functions here. fn endpoint_a_0_v_0(s: Endpoint_0_ForA, all_clocks: &mut HashMap) -> Result<(), Box> { all_clocks.insert('a', Instant::now()); Ok(()) } fn endpoint_b_0_v_0(s: Endpoint_0_ForB, all_clocks: &mut HashMap) -> Result<(), Box> { all_clocks.insert('a', Instant::now()); Ok(()) } fn endpoint_c_0_v_0(s: Endpoint_0_ForC, all_clocks: &mut HashMap) -> Result<(), Box> { all_clocks.insert('a', Instant::now()); Ok(()) } fn main() { let (thread_a, thread_b, thread_c, ) = fork_mpst(endpoint_a_0_v_0, endpoint_b_0_v_0, endpoint_c_0_v_0, ); println!("Thread A: {:?}", thread_a.join()); println!("Thread B: {:?}", thread_b.join()); println!("Thread C: {:?}", thread_c.join()); }