Macro mpstthree::create_send_check_cancel[][src]

macro_rules! create_send_check_cancel {
    ($func_name : ident, $receiver : ident, $sender : ident, $meshedchannels_name
 : ident, $nsessions : literal, $exclusion : literal) => { ... };
}
Expand description

Creates a send function to send from a given binary session type of a MeshedChannels with more than 3 participants. Checks if the first binary session has a “cancel” signal and panic if yes. The send function will try to send and panic if not possible (canceled session).

Arguments

  • The name of the new send function
  • The name of the receiver
  • The name of the sender
  • The name of the MeshedChannels type that will be used
  • The number of participants (all together)
  • The index of the binary session type that will receive in the MeshedChannels for this specific role. Index starts at 2 as 1 is an End.

Example

use mpstthree::role::Role;
use mpstthree::{create_normal_role, create_send_check_cancel, create_meshedchannels};

create_normal_role!(RoleB, RoleBDual);
create_normal_role!(RoleD, RoleDDual);

create_meshedchannels!(MeshedChannels, 3);

create_send_check_cancel!(send_cancel_d_to_b, RoleB, RoleD, MeshedChannels, 3, 2);

Compile fail

use mpstthree::role::Role;
use mpstthree::{create_normal_role, create_send_check_cancel, create_meshedchannels};

create_normal_role!(RoleA, RoleADual);
create_normal_role!(RoleD, RoleDDual);

create_meshedchannels!(MeshedChannels, 3);

create_send_check_cancel!(send_cancel_d_to_b, RoleA, RoleD, MeshedChannels, 3, 1);