telltale-machine 17.0.0

Protocol machine for choreographic session type protocols
Documentation
//! Communication instruction execution.

use crate::coroutine::Fault;
use crate::effect::EffectHandler;
use crate::engine::{ProtocolMachine, StepPack};

pub(crate) fn step_send(
    machine: &mut ProtocolMachine,
    coro_idx: usize,
    role: &str,
    chan: u16,
    val_reg: u16,
    handler: &dyn EffectHandler,
) -> Result<StepPack, Fault> {
    machine.step_send(coro_idx, role, chan, val_reg, handler)
}

pub(crate) fn step_receive(
    machine: &mut ProtocolMachine,
    coro_idx: usize,
    role: &str,
    chan: u16,
    dst: u16,
    handler: &dyn EffectHandler,
) -> Result<StepPack, Fault> {
    machine.step_recv(coro_idx, role, chan, dst, handler)
}

pub(crate) fn step_offer(
    machine: &mut ProtocolMachine,
    coro_idx: usize,
    role: &str,
    chan: u16,
    label: &str,
    handler: &dyn EffectHandler,
) -> Result<StepPack, Fault> {
    machine.step_offer(coro_idx, role, chan, label, handler)
}

pub(crate) fn step_choose(
    machine: &mut ProtocolMachine,
    coro_idx: usize,
    role: &str,
    chan: u16,
    table: &[(String, usize)],
    handler: &dyn EffectHandler,
) -> Result<StepPack, Fault> {
    machine.step_choose(coro_idx, role, chan, table, handler)
}