Change vector of structs



examples/ownership/change-vector-of-structs/src/main.rs
fn main() {
    let mut graph = get_graph();
    dbg!(&graph);
    move_graph(&mut graph);
    dbg!(&graph);
}

fn get_graph() -> Vec<Point> {
    vec![
        Point {x: 0, y: 0},
        Point {x: 10, y: 20},
        Point {x: 30, y: 40},
    ]

}

fn move_graph(graph: &mut Vec<Point>) {
    for point in graph {
        point.x += 100;
    }
}


#[derive(Debug)]
#[allow(dead_code)]
struct Point {
    x: i32,
    y: i32,
}

[examples/ownership/change_vector_of_structs.rs:3] &graph = [
    Point {
        x: 0,
        y: 0,
    },
    Point {
        x: 10,
        y: 20,
    },
    Point {
        x: 30,
        y: 40,
    },
]
[examples/ownership/change_vector_of_structs.rs:5] &graph = [
    Point {
        x: 100,
        y: 0,
    },
    Point {
        x: 110,
        y: 20,
    },
    Point {
        x: 130,
        y: 40,
    },
]