From 689e0f4ad784390c39ed614358f14a722be7dc17 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Thu, 29 Dec 2016 11:09:29 -0500 Subject: Unify Cursor, Location and name it Point --- src/grid.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/grid.rs') diff --git a/src/grid.rs b/src/grid.rs index 07255cb4..77fe92b9 100644 --- a/src/grid.rs +++ b/src/grid.rs @@ -27,7 +27,7 @@ use std::ops::{Deref, DerefMut, Range, RangeTo, RangeFrom, RangeFull, Index, Ind use std::ops::RangeInclusive; use std::slice::{self, Iter, IterMut}; -use index::{self, Cursor}; +use index::{self, Point}; /// Convert a type to a linear index range. pub trait ToRange { @@ -141,8 +141,8 @@ impl Grid { } #[inline] - pub fn contains(&self, cursor: &Cursor) -> bool { - self.lines > cursor.line && self.cols > cursor.col + pub fn contains(&self, point: &Point) -> bool { + self.lines > point.line && self.cols > point.col } /// Swap two lines in the grid @@ -210,19 +210,19 @@ impl IndexMut for Grid { } } -impl<'cursor, T> Index<&'cursor Cursor> for Grid { +impl<'point, T> Index<&'point Point> for Grid { type Output = T; #[inline] - fn index<'a>(&'a self, cursor: &Cursor) -> &'a T { - &self.raw[cursor.line.0][cursor.col] + fn index<'a>(&'a self, point: &Point) -> &'a T { + &self.raw[point.line.0][point.col] } } -impl<'cursor, T> IndexMut<&'cursor Cursor> for Grid { +impl<'point, T> IndexMut<&'point Point> for Grid { #[inline] - fn index_mut<'a, 'b>(&'a mut self, cursor: &'b Cursor) -> &'a mut T { - &mut self.raw[cursor.line.0][cursor.col] + fn index_mut<'a, 'b>(&'a mut self, point: &'b Point) -> &'a mut T { + &mut self.raw[point.line.0][point.col] } } -- cgit v1.2.3-54-g00ecf