In egui-snarl, modifications to the graph (like adding nodes or connecting pins) are often handled via deferred execution using the Effects<T> container. Instead of mutating the Snarl<T> directly in every UI interaction, you can collect Effect<T> operations into an Effects<T> instance and then apply them all at once using Snarl::apply_effects.
This pattern is commonly used by SnarlViewer to populate a list of changes that are subsequently applied to the underlying data model.
// Example of collecting and applying effects
let mut effects = Effects::new();
// Record some operations
effects.insert_node(pos, my_node);
effects.connect(out_pin, in_pin);
// Apply them to the snarl
snarl.apply_effects(effects);