From c574bf6ad2c888858ff39883a076cd3fec290991 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Tue, 12 Jan 2021 22:40:15 +0100 Subject: [PATCH] move GridView & GridOffset into separate grid module --- src/{view/grid.rs => grid/mod.rs} | 28 +++----------------------- src/{grid_offset.rs => grid/offset.rs} | 6 +++--- src/terminal/compositor.rs | 3 ++- src/terminal/mod.rs | 6 +----- src/terminal/terminal.rs | 6 +++--- src/view/mod.rs | 2 -- 6 files changed, 12 insertions(+), 39 deletions(-) rename src/{view/grid.rs => grid/mod.rs} (68%) rename src/{grid_offset.rs => grid/offset.rs} (96%) diff --git a/src/view/grid.rs b/src/grid/mod.rs similarity index 68% rename from src/view/grid.rs rename to src/grid/mod.rs index 81bddf8..a961970 100644 --- a/src/view/grid.rs +++ b/src/grid/mod.rs @@ -10,35 +10,13 @@ use { } }; +pub mod offset; +pub use offset::GridOffset; + //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> pub trait GridView = IndexView>; -//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> -/* -pub trait ImplGridView : Send + Sync { - type Item; - - fn get(&self, pos: &Point2) -> Self::Item; - - fn range(&self) -> Option>> { - None - } -} - -impl ImplIndexView for V { - type Key = Point2; - type Value = V::Item; - - fn get(&self, pos: &Point2) -> V::Item { - (self as &V).get(pos) - } - - fn range(&self) -> Option>> { - (self as &V).range() - } -} -*/ //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> pub struct GridWindowIterator { diff --git a/src/grid_offset.rs b/src/grid/offset.rs similarity index 96% rename from src/grid_offset.rs rename to src/grid/offset.rs index f4ec661..749159d 100644 --- a/src/grid_offset.rs +++ b/src/grid/offset.rs @@ -13,9 +13,9 @@ use { InnerViewPort }, view::{ - index::{IndexView, ImplIndexView}, - grid::{GridView, GridWindowIterator} - } + index::IndexView + }, + grid::{GridView, GridWindowIterator} } }; diff --git a/src/terminal/compositor.rs b/src/terminal/compositor.rs index ad346b5..8cb6636 100644 --- a/src/terminal/compositor.rs +++ b/src/terminal/compositor.rs @@ -8,7 +8,8 @@ use { cgmath::Point2, crate::{ core::{View, ViewPort, InnerViewPort, OuterViewPort, Observer, ObserverExt, ObserverBroadcast}, - view::{ImplIndexView, grid::GridWindowIterator}, + view::{ImplIndexView}, + grid::{GridWindowIterator}, terminal::{TerminalAtom, TerminalView} } }; diff --git a/src/terminal/mod.rs b/src/terminal/mod.rs index f07e7eb..40f350d 100644 --- a/src/terminal/mod.rs +++ b/src/terminal/mod.rs @@ -12,11 +12,7 @@ pub use { use { crate::{ - core::View, - view::{ - IndexView, - GridView - } + grid::GridView }, cgmath::Point2, std::ops::Range diff --git a/src/terminal/terminal.rs b/src/terminal/terminal.rs index 193de9c..7266e8a 100644 --- a/src/terminal/terminal.rs +++ b/src/terminal/terminal.rs @@ -27,9 +27,9 @@ use { } }, view::{ - IndexView, - grid::GridWindowIterator - } + IndexView + }, + grid::{GridView, GridWindowIterator} }, super::{ TerminalStyle, diff --git a/src/view/mod.rs b/src/view/mod.rs index de3db23..a4c6d6b 100644 --- a/src/view/mod.rs +++ b/src/view/mod.rs @@ -1,13 +1,11 @@ pub mod singleton; pub mod index; pub mod sequence; -pub mod grid; pub use { singleton::SingletonView, index::{IndexView, ImplIndexView}, sequence::SequenceView, - grid::GridView, crate::core::View };