Skip to main content

grid_map/map/
grid_map.rs

1use crate::Dim;
2use std::fmt::{Display, Formatter};
3
4/// A two-dimensional grid map.
5#[derive(Clone, Debug)]
6pub struct GridMap<T> {
7    pub(in crate::map) dims: Dim,
8    pub(in crate::map) cells: Vec<T>,
9}
10
11impl<T> GridMap<T> {
12    //! Properties
13
14    /// Gets the dimensions.
15    pub const fn dims(&self) -> Dim {
16        self.dims
17    }
18}
19
20impl<T> Display for GridMap<T> {
21    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
22        write!(f, "map[{}]", self.dims)
23    }
24}