Skip to main content

apply_wire

Function apply_wire 

pub fn apply_wire(sop: &mut Sop, edit: &WireEdit) -> Result<(), WireError>
Expand description

Apply one wire edit to a draft SOP, mutating the routing field the edit’s role maps to. Validates both endpoints first; on Err the SOP is unchanged. Semantics per role:

  • Sequence connect sets routing.next and clears terminal; disconnect clears a matching next and sets terminal so the implicit fallthrough edge does not immediately reappear.
  • Dependency edits to’s depends_on (connect is idempotent).
  • Failure sets/clears on_failure: goto on from.
  • Switch sets/clears routing.switch[port].goto on from; connect grows the port list with default rules up to port.