move GridView & GridOffset into separate grid module

This commit is contained in:
Michael Sippel 2021-01-12 22:40:15 +01:00
parent f76a56f7b9
commit c574bf6ad2
Signed by: senvas
GPG key ID: F96CF119C34B64A6
6 changed files with 12 additions and 39 deletions

View file

@ -10,35 +10,13 @@ use {
} }
}; };
pub mod offset;
pub use offset::GridOffset;
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
pub trait GridView = IndexView<Point2<i16>>; pub trait GridView = IndexView<Point2<i16>>;
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
/*
pub trait ImplGridView : Send + Sync {
type Item;
fn get(&self, pos: &Point2<i16>) -> Self::Item;
fn range(&self) -> Option<Range<Point2<i16>>> {
None
}
}
impl<V: ImplGridView> ImplIndexView for V {
type Key = Point2<i16>;
type Value = V::Item;
fn get(&self, pos: &Point2<i16>) -> V::Item {
(self as &V).get(pos)
}
fn range(&self) -> Option<Range<Point2<i16>>> {
(self as &V).range()
}
}
*/
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
pub struct GridWindowIterator { pub struct GridWindowIterator {

View file

@ -13,9 +13,9 @@ use {
InnerViewPort InnerViewPort
}, },
view::{ view::{
index::{IndexView, ImplIndexView}, index::IndexView
grid::{GridView, GridWindowIterator} },
} grid::{GridView, GridWindowIterator}
} }
}; };

View file

@ -8,7 +8,8 @@ use {
cgmath::Point2, cgmath::Point2,
crate::{ crate::{
core::{View, ViewPort, InnerViewPort, OuterViewPort, Observer, ObserverExt, ObserverBroadcast}, core::{View, ViewPort, InnerViewPort, OuterViewPort, Observer, ObserverExt, ObserverBroadcast},
view::{ImplIndexView, grid::GridWindowIterator}, view::{ImplIndexView},
grid::{GridWindowIterator},
terminal::{TerminalAtom, TerminalView} terminal::{TerminalAtom, TerminalView}
} }
}; };

View file

@ -12,11 +12,7 @@ pub use {
use { use {
crate::{ crate::{
core::View, grid::GridView
view::{
IndexView,
GridView
}
}, },
cgmath::Point2, cgmath::Point2,
std::ops::Range std::ops::Range

View file

@ -27,9 +27,9 @@ use {
} }
}, },
view::{ view::{
IndexView, IndexView
grid::GridWindowIterator },
} grid::{GridView, GridWindowIterator}
}, },
super::{ super::{
TerminalStyle, TerminalStyle,

View file

@ -1,13 +1,11 @@
pub mod singleton; pub mod singleton;
pub mod index; pub mod index;
pub mod sequence; pub mod sequence;
pub mod grid;
pub use { pub use {
singleton::SingletonView, singleton::SingletonView,
index::{IndexView, ImplIndexView}, index::{IndexView, ImplIndexView},
sequence::SequenceView, sequence::SequenceView,
grid::GridView,
crate::core::View crate::core::View
}; };