rust/vec2d/src/lib.rs
author unC0Rr
Wed, 18 Sep 2024 13:42:26 +0200
branchtransitional_engine
changeset 16035 0caa3dfb3ba2
parent 15915 8f093b1b18bc
permissions -rw-r--r--
Add templates for different maze styles
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15913
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
     1
use integral_geometry::Size;
14207
bb2f301d4fe0 2018ize everything
alfadur
parents: 14170
diff changeset
     2
use std::{
bb2f301d4fe0 2018ize everything
alfadur
parents: 14170
diff changeset
     3
    ops::{Index, IndexMut},
15913
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
     4
    slice::SliceIndex,
14207
bb2f301d4fe0 2018ize everything
alfadur
parents: 14170
diff changeset
     5
};
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
     6
15912
6e22f4390b7e Add basics of wavefront collapse algorithm
unC0Rr
parents: 15901
diff changeset
     7
#[derive(Debug)]
13916
cd437d76978a Add get_mut() to Vec2D
unc0rr
parents: 13915
diff changeset
     8
pub struct Vec2D<T> {
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
     9
    data: Vec<T>,
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    10
    size: Size,
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    11
}
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    12
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    13
impl<T> Index<usize> for Vec2D<T> {
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    14
    type Output = [T];
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    15
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    16
    #[inline]
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    17
    fn index(&self, row: usize) -> &[T] {
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    18
        debug_assert!(row < self.height());
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    19
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    20
        let pos = row * self.width();
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    21
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    22
        &self.data[pos..pos + self.width()]
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    23
    }
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    24
}
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    25
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    26
impl<T> IndexMut<usize> for Vec2D<T> {
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    27
    #[inline]
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    28
    fn index_mut(&mut self, row: usize) -> &mut [T] {
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    29
        debug_assert!(row < self.height());
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    30
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    31
        let pos = row * self.width();
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    32
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    33
        &mut self.data[pos..pos + self.size.width]
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    34
    }
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    35
}
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    36
15913
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    37
impl<T> Vec2D<T> {
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    38
    #[inline]
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    39
    pub fn width(&self) -> usize {
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    40
        self.size.width
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    41
    }
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    42
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    43
    #[inline]
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    44
    pub fn height(&self) -> usize {
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    45
        self.size.height
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    46
    }
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    47
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    48
    #[inline]
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    49
    pub fn size(&self) -> Size {
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    50
        self.size
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    51
    }
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    52
}
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    53
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
    54
impl<T: Copy> Vec2D<T> {
15913
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    55
    pub fn new(size: &Size, value: T) -> Self {
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    56
        Self {
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    57
            size: *size,
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    58
            data: vec![value; size.area()],
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    59
        }
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
    60
    }
13916
cd437d76978a Add get_mut() to Vec2D
unc0rr
parents: 13915
diff changeset
    61
14160
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
    62
    #[inline]
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
    63
    pub fn as_slice(&self) -> &[T] {
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
    64
        self.data.as_slice()
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
    65
    }
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
    66
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
    67
    #[inline]
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
    68
    pub fn as_mut_slice(&mut self) -> &mut [T] {
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
    69
        self.data.as_mut_slice()
14121
69db1d2e4cec land_dump app for testing templated landgen
unc0rr
parents: 14032
diff changeset
    70
    }
69db1d2e4cec land_dump app for testing templated landgen
unc0rr
parents: 14032
diff changeset
    71
13916
cd437d76978a Add get_mut() to Vec2D
unc0rr
parents: 13915
diff changeset
    72
    #[inline]
13930
5c9d963492bf Implement get_unchecked* functions for Vec2D
unc0rr
parents: 13924
diff changeset
    73
    pub fn get(&self, row: usize, column: usize) -> Option<&<usize as SliceIndex<[T]>>::Output> {
15913
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    74
        if row < self.height() && column < self.width() {
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    75
            Some(unsafe { self.data.get_unchecked(row * self.width() + column) })
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    76
        } else {
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    77
            None
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    78
        }
13930
5c9d963492bf Implement get_unchecked* functions for Vec2D
unc0rr
parents: 13924
diff changeset
    79
    }
5c9d963492bf Implement get_unchecked* functions for Vec2D
unc0rr
parents: 13924
diff changeset
    80
5c9d963492bf Implement get_unchecked* functions for Vec2D
unc0rr
parents: 13924
diff changeset
    81
    #[inline]
15913
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    82
    pub fn get_mut(
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    83
        &mut self,
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    84
        row: usize,
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    85
        column: usize,
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    86
    ) -> Option<&mut <usize as SliceIndex<[T]>>::Output> {
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    87
        if row < self.height() && column < self.width() {
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    88
            Some(unsafe { self.data.get_unchecked_mut(row * self.size.width + column) })
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    89
        } else {
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    90
            None
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    91
        }
13916
cd437d76978a Add get_mut() to Vec2D
unc0rr
parents: 13915
diff changeset
    92
    }
13924
a140f28decc4 Implement Land2D::fill() + tests
unc0rr
parents: 13916
diff changeset
    93
a140f28decc4 Implement Land2D::fill() + tests
unc0rr
parents: 13916
diff changeset
    94
    #[inline]
15913
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    95
    pub unsafe fn get_unchecked(
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    96
        &self,
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    97
        row: usize,
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    98
        column: usize,
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
    99
    ) -> &<usize as SliceIndex<[T]>>::Output {
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
   100
        self.data.get_unchecked(row * self.width() + column)
13930
5c9d963492bf Implement get_unchecked* functions for Vec2D
unc0rr
parents: 13924
diff changeset
   101
    }
5c9d963492bf Implement get_unchecked* functions for Vec2D
unc0rr
parents: 13924
diff changeset
   102
5c9d963492bf Implement get_unchecked* functions for Vec2D
unc0rr
parents: 13924
diff changeset
   103
    #[inline]
15913
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
   104
    pub unsafe fn get_unchecked_mut(
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
   105
        &mut self,
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
   106
        row: usize,
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
   107
        column: usize,
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
   108
    ) -> &mut <usize as SliceIndex<[T]>>::Output {
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
   109
        self.data.get_unchecked_mut(row * self.size.width + column)
13924
a140f28decc4 Implement Land2D::fill() + tests
unc0rr
parents: 13916
diff changeset
   110
    }
14030
2ebd505e62c1 make theme editor render some random map lines
alfadur
parents: 13930
diff changeset
   111
2ebd505e62c1 make theme editor render some random map lines
alfadur
parents: 13930
diff changeset
   112
    #[inline]
14170
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14160
diff changeset
   113
    pub fn rows(&self) -> impl DoubleEndedIterator<Item = &[T]> {
14350
31717e1436cd recruit some newly stabilized functions
alfadur
parents: 14207
diff changeset
   114
        self.data.chunks_exact(self.width())
14030
2ebd505e62c1 make theme editor render some random map lines
alfadur
parents: 13930
diff changeset
   115
    }
14160
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   116
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   117
    #[inline]
14170
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14160
diff changeset
   118
    pub fn rows_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut [T]> {
14160
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   119
        let width = self.width();
14350
31717e1436cd recruit some newly stabilized functions
alfadur
parents: 14207
diff changeset
   120
        self.data.chunks_exact_mut(width)
14160
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   121
    }
14702
29dbe9ce8b7d add basic map rendering with gl
fkaa
parents: 14350
diff changeset
   122
29dbe9ce8b7d add basic map rendering with gl
fkaa
parents: 14350
diff changeset
   123
    #[inline]
29dbe9ce8b7d add basic map rendering with gl
fkaa
parents: 14350
diff changeset
   124
    pub unsafe fn as_bytes(&self) -> &[u8] {
15913
c5684cc62de8 Switch to Vec2D in wavefront algorithm
unC0Rr
parents: 15912
diff changeset
   125
        use std::{mem, slice};
15901
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 14702
diff changeset
   126
14702
29dbe9ce8b7d add basic map rendering with gl
fkaa
parents: 14350
diff changeset
   127
        slice::from_raw_parts(
29dbe9ce8b7d add basic map rendering with gl
fkaa
parents: 14350
diff changeset
   128
            self.data.as_ptr() as *const u8,
29dbe9ce8b7d add basic map rendering with gl
fkaa
parents: 14350
diff changeset
   129
            self.data.len() * mem::size_of::<T>(),
29dbe9ce8b7d add basic map rendering with gl
fkaa
parents: 14350
diff changeset
   130
        )
29dbe9ce8b7d add basic map rendering with gl
fkaa
parents: 14350
diff changeset
   131
    }
14160
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   132
}
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   133
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   134
impl<T: Copy> AsRef<[T]> for Vec2D<T> {
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   135
    fn as_ref(&self) -> &[T] {
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   136
        self.as_slice()
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   137
    }
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   138
}
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   139
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   140
impl<T: Copy> AsMut<[T]> for Vec2D<T> {
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   141
    fn as_mut(&mut self) -> &mut [T] {
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   142
        self.as_mut_slice()
c24a76f131d6 implement basic land texturing
alfadur
parents: 14121
diff changeset
   143
    }
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   144
}
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   145
15915
8f093b1b18bc Add loading of tiles from png
unC0Rr
parents: 15913
diff changeset
   146
impl<T: Clone> Vec2D<T> {
8f093b1b18bc Add loading of tiles from png
unC0Rr
parents: 15913
diff changeset
   147
    pub fn from_iter<I: IntoIterator<Item = T>>(iter: I, size: &Size) -> Option<Vec2D<T>> {
8f093b1b18bc Add loading of tiles from png
unC0Rr
parents: 15913
diff changeset
   148
        let data: Vec<T> = iter.into_iter().collect();
8f093b1b18bc Add loading of tiles from png
unC0Rr
parents: 15913
diff changeset
   149
        if size.width * size.height == data.len() {
8f093b1b18bc Add loading of tiles from png
unC0Rr
parents: 15913
diff changeset
   150
            Some(Vec2D { data, size: *size })
8f093b1b18bc Add loading of tiles from png
unC0Rr
parents: 15913
diff changeset
   151
        } else {
8f093b1b18bc Add loading of tiles from png
unC0Rr
parents: 15913
diff changeset
   152
            None
8f093b1b18bc Add loading of tiles from png
unC0Rr
parents: 15913
diff changeset
   153
        }
8f093b1b18bc Add loading of tiles from png
unC0Rr
parents: 15913
diff changeset
   154
    }
8f093b1b18bc Add loading of tiles from png
unC0Rr
parents: 15913
diff changeset
   155
}
8f093b1b18bc Add loading of tiles from png
unC0Rr
parents: 15913
diff changeset
   156
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   157
#[cfg(test)]
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   158
mod tests {
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   159
    use super::*;
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   160
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   161
    #[test]
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   162
    fn basics() {
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
   163
        let mut v: Vec2D<u8> = Vec2D::new(Size::new(2, 3), 0xff);
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   164
14032
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
   165
        assert_eq!(v.width(), 2);
2869c2ccb1b8 extract size struct for common usage
alfadur
parents: 14030
diff changeset
   166
        assert_eq!(v.height(), 3);
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   167
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   168
        assert_eq!(v[0][0], 0xff);
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   169
        assert_eq!(v[2][1], 0xff);
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   170
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   171
        v[2][1] = 0;
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   172
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   173
        assert_eq!(v[2][0], 0xff);
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   174
        assert_eq!(v[2][1], 0);
13916
cd437d76978a Add get_mut() to Vec2D
unc0rr
parents: 13915
diff changeset
   175
cd437d76978a Add get_mut() to Vec2D
unc0rr
parents: 13915
diff changeset
   176
        v.get_mut(2, 1).map(|v| *v = 1);
cd437d76978a Add get_mut() to Vec2D
unc0rr
parents: 13915
diff changeset
   177
        assert_eq!(v[2][1], 1);
cd437d76978a Add get_mut() to Vec2D
unc0rr
parents: 13915
diff changeset
   178
cd437d76978a Add get_mut() to Vec2D
unc0rr
parents: 13915
diff changeset
   179
        assert_eq!(v.get_mut(2, 2), None);
13911
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   180
    }
fa9f93393e9c Implement vec2d library to use for land arrays in the future
unc0rr
parents:
diff changeset
   181
}