Function mpstthree::functionmpst::close::close_mpst
source · pub fn close_mpst<N>(
s: MeshedChannels<End, End, RoleEnd, N>
) -> Result<(), Box<dyn Error>>where
N: Name,
Expand description
Closes a MeshedChannels
.
Synchronises with all partners, and fails if one of the partners has crashed.
§Example
use mpstthree::binary::struct_trait::{end::End, session::Session};
use mpstthree::meshedchannels::MeshedChannels;
use mpstthree::name::Name;
use mpstthree::role::Role;
use mpstthree::role::end::RoleEnd;
use mpstthree::name::a::NameA;
use mpstthree::functionmpst::close::close_mpst;
// Creating the binary sessions
type AtoB = End;
type AtoC = End;
// Stack
type StackA = RoleEnd;
// From this point...
let (channel_ab, _) = AtoB::new();
let (channel_ac, _) = AtoC::new();
let (role_a, _) = StackA::new();
let (name_a, _) = NameA::new();
let sess = MeshedChannels {
session1: channel_ab,
session2: channel_ac,
stack: role_a,
name: name_a,
};
// ...to this point, should not be written in general. Please look at the *fork* function.
let _s = close_mpst(sess);