Skip to main content

set_node

Function set_node 

Source
pub fn set_node(rule: &mut Rule, value: Value)
Expand description

Set a rule’s node value.

A rule pushed by the engine SHARES its parent’s node cell, so writing through rule.node.borrow_mut() would overwrite the parent’s node too. Assigning a result — what rule.node = … means in the canonical TypeScript engine — has to install a fresh cell instead, which is what this does. Reach for rule.node.borrow_mut() only to mutate a container the rule genuinely shares (pushing onto an enclosing list, say).

Every directive action wanting to produce a value should go through here.