Function moonlander_gp::clone_or_replace [] [src]

pub fn clone_or_replace<T: AstNode + Clone>(
    child: &T,
    old_child: &AstNode,
    new_child: &mut Option<Box<AstNode>>
) -> Box<T>

Helper function for use inside replace_children().

Call this for every child node in replace_children(). The new_child is a &mut Option<> so that we can be sure we consume it exactly once.