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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
pub mod cancel;
pub mod choose;
pub mod close;
pub mod fork;
pub mod meshedchannels;
pub mod offer;
pub mod recv;
pub mod send;

/// Creates thestructure SessionMPST
/// [`mpstthree::create_meshedchannels`](../macro.create_meshedchannels.html),
/// the [`mpstthree::close_mpst`](../macro.close_mpst.html) and
/// [`mpstthree::fork_mpst_multi`](../macro.fork_mpst_multi.html).
///
/// # Arguments
///
/// * The name of the new *close* function
/// * The name of the new *fork* function
/// * The name of the *MeshedChannels* type that will be used
/// * The number of participants (all together)
///
/// # Example
///
/// ```
/// use mpstthree::bundle_struct_fork_close_multi;
///
/// bundle_struct_fork_close_multi!(close_mpst, fork_mpst, MeshedChannels, 3);
/// ```
#[macro_export]
macro_rules! bundle_struct_fork_close_multi {
    ($func_name_close: ident, $func_name_fork: ident, $meshedchannels_name: ident, $nsessions: literal) => {
        mpstthree::create_meshedchannels!($meshedchannels_name, $nsessions);
        mpstthree::close_mpst!($func_name_close, $meshedchannels_name, $nsessions);
        mpstthree::fork_mpst_multi!($func_name_fork, $meshedchannels_name, $nsessions);
    };
}

/// Creates thestructure SessionMPST
/// [`mpstthree::create_meshedchannels`](../macro.create_meshedchannels.html),
/// the [`mpstthree::close_mpst_cancel`](../macro.close_mpst_cancel.html) and
/// [`mpstthree::fork_mpst_multi`](../macro.fork_mpst_multi.html)
/// functions to be used with more than 2 participants.
/// It checks the send sides of the channels along the recv sides.
///
/// # Arguments
///
/// * The name of the new *close* function
/// * The name of the new *fork* function
/// * The name of the *MeshedChannels* type that will be used
/// * The number of participants (all together)
///
/// # Example
///
/// ```
/// use mpstthree::bundle_struct_fork_close_multi_cancel;
///
/// bundle_struct_fork_close_multi_cancel!(close_mpst, fork_mpst, MeshedChannels, 3);
/// ```
#[macro_export]
macro_rules! bundle_struct_fork_close_multi_cancel {
    ($func_name_close: ident, $func_name_fork: ident, $meshedchannels_name: ident, $nsessions: literal) => {
        mpstthree::create_meshedchannels!($meshedchannels_name, $nsessions);
        mpstthree::close_mpst_cancel!($func_name_close, $meshedchannels_name, $nsessions);
        mpstthree::fork_mpst_multi!($func_name_fork, $meshedchannels_name, $nsessions);
    };
}