summaryrefslogtreecommitdiffstats
path: root/src/grid/storage.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/grid/storage.rs')
-rw-r--r--src/grid/storage.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/grid/storage.rs b/src/grid/storage.rs
index 1588b006..0f1ba9c5 100644
--- a/src/grid/storage.rs
+++ b/src/grid/storage.rs
@@ -13,15 +13,25 @@
/// done so manually.
use std::ops::{Index, IndexMut};
-use index::Line;
+use index::{IndexRange, Line};
-#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
+#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Storage<T> {
inner: Vec<T>,
zero: usize,
visible_lines: Line,
}
+impl<T: PartialEq> ::std::cmp::PartialEq for Storage<T> {
+ fn eq(&self, other: &Self) -> bool {
+ let mut equal = true;
+ for i in IndexRange(Line(0) .. self.visible_lines) {
+ equal = equal && (self[i] == other[i])
+ }
+ equal
+ }
+}
+
impl<T> Storage<T> {
#[inline]
pub fn with_capacity(cap: usize, lines: Line) -> Storage<T> {