Experiment with optional dimensions.
@@ -22,8 +22,10 @@ pub trait Algorithm2D: BaseMap {
)
}
- /// Retrieve the map's dimensions
- fn dimensions(&self) -> Point;
+ /// Retrieve the map's dimensions. Made optional to reduce API breakage.
+ fn dimensions(&self) -> Point {
+ panic!("You must either define the dimensions function (trait Algorithm2D) on your map, or define the various point2d_to_index and index_to_point2d functions.");
+ }
// Optional - check that an x/y coordinate is within the map bounds. If not provided,
// it falls back to using the map's dimensions from that trait implementation. Most of
