Skip to main content

apply_atomic

Function apply_atomic 

Source
fn apply_atomic<F>(
    state: &mut State,
    tab_id: &str,
    op: &str,
    f: F,
) -> Result<(), Vec<Event>>
where F: FnOnce(&mut LayoutNode) -> Result<(), LayoutError>,
Expand description

Apply a fallible structural mutation to a tab’s layout tree atomically: operate on a clone, run balance_node, and commit back to tab.rootnode only if both succeed. On any error the tab’s tree is left untouched — no partial mutation is visible to a later snapshot or to the next operation. [codex P2 #1868]

On error, returns the Event::Error vec the caller should return verbatim (unknown tab, empty tree, op failure, or balance failure). On success, returns Ok(()); the caller re-fetches the tab for focus/magnify reconciliation and to emit the granular event.