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

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

Send a value of type T from C to A. 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_c_to_a;

// Creating the binary sessions
type CtoA<N> = Send<N, End>;
type CtoB = End;

// Stack
type StackC = RoleA<RoleEnd>;

// Name
type NameC = RoleC<RoleEnd>;

// From this point...

let (channel_ca, _) = CtoA::<i32>::new();
let (channel_cb, _) = CtoB::new();

let (role_c, _) = StackC::new();

let (name_c, _) = NameC::new();

let sess = MeshedChannels {
    session1: channel_ca,
    session2: channel_cb,
    stack: role_c,
    name: name_c,
};

// ...to this point, should not be written in general. Please look at the *fork* function.

let _s = send_mpst_c_to_a(1, sess);