Skip to content

Commit

Permalink
Add some methods to the Point record
Browse files Browse the repository at this point in the history
This code works, because `declare_interface` auto-inserts the `pub use geometry::Point` statement.
As a Rust dev this _reads_ weird, because conceptually `Point` is in a
submodule that is no where explicitly `use`d.
This might be a bit too much magic.
  • Loading branch information
badboy committed Aug 5, 2021
1 parent 9613f96 commit 87448da
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/geometry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,10 @@ mod geometry {
})
}
}

impl Point {
fn move_to(&mut self, x: f64, y: f64) {
self.coord_x += x;
self.coord_y += y;
}
}

0 comments on commit 87448da

Please sign in to comment.