Petgraph: How can I remove all of the outgoing edges for a given node in a GraphMap?

I'm trying to figure out how to make this example work. It wont compile with "closure requires unique access to *graph but it is already borrowed closure construction occurs here." On this line...

g.edges_directed(node1, Direction::Outgoing).for_each(|edge| {
    g.remove_edge(edge.source(), edge.target());
});      

I'm new to both rust and petgraph and would appreciate any help on an idiomatic way to implement this. My intent is to remove all of the outgoing edges for a given node in a directed GraphMap.

use petgraph::{graphmap::GraphMap, visit::EdgeRef, Directed, Direction};
fn main() {
    let mut g = GraphMap::<MyNode, u32, Directed>::new();  
    let node1 = MyNode { value1: 1, value2: 1 };
    let node2 = MyNode { value1: 2, value2: 2 };

    g.add_node(node1);
    g.add_node(node2);
    g.add_edge(node1, node2, 1);
    
    g.edges_directed(node1, Direction::Outgoing).for_each(|edge| {
        g.remove_edge(edge.source(), edge.target());
    });      

    println!("{:?}", g);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct MyNode {
    pub value1: u32,
    pub value2: u32,
}

Playground

I think the only way is to separate those steps: save the removal list first, then remove them.

    let targets: Vec<_> = g
        .edges_directed(node1, Direction::Outgoing)
        .map(|(_source, target, _weight)| target)
        .collect();
    targets.into_iter().for_each(|target| {
        g.remove_edge(node1, target);
    });

(or for target in targets {...}, but I kept your for_each style)

Thank you!!!