Function mpstthree::functionmpst::send::send_mpst_a_to_c[][src]

pub fn send_mpst_a_to_c<T, S1, S2, R>(
    x: T,
    s: MeshedChannels<S1, Send<T, S2>, RoleC<R>, RoleA<RoleEnd>>
) -> MeshedChannels<S1, S2, R, RoleA<RoleEnd>> where
    T: Send,
    S1: Session,
    S2: Session,
    R: Role
Expand description

Send a value of type T from A to C. Always succeeds. Returns the continuation of the MeshedChannels<S1, S2, R, N>.

Example

use mpstthree::binary::struct_trait::{end::End, send::Send, session::Session};
use mpstthree::meshedchannels::MeshedChannels;
use mpstthree::role::Role;

use mpstthree::role::a::RoleA;
use mpstthree::role::c::RoleC;
use mpstthree::role::end::RoleEnd;

use mpstthree::functionmpst::send::send_mpst_a_to_c;

// Creating the binary sessions
type AtoB = End;
type AtoC<N> = Send<N, End>;

// Stack
type StackA = RoleC<RoleEnd>;

// Name
type NameA = RoleA<RoleEnd>;

// From this point...

let (channel_ab, _) = AtoB::new();
let (channel_ac, _) = AtoC::<i32>::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 = send_mpst_a_to_c(1, sess);