Function taking a mutable borrow of the whole Point
(p: &mut Point)
| 19 | } |
| 20 | |
| 21 | // Function taking a shared borrow of a Point and reading |
| 22 | fn get_x_coord(p: &Point) -> i32 { |
| 23 | p.x // Just read the x field |
| 24 | } |
| 25 | |
| 26 | // Function taking a mutable borrow of the whole Point |
| 27 | fn shift_point(p: &mut Point) { |
| 28 | p.x += 10; // Modify field directly via mutable borrow of struct |
no test coverage detected