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 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 {

View file

@ -13,10 +13,10 @@ use {
InnerViewPort
},
view::{
index::{IndexView, ImplIndexView},
index::IndexView
},
grid::{GridView, GridWindowIterator}
}
}
};
pub struct GridOffset<V: GridView + ?Sized> {

View file

@ -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}
}
};

View file

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

View file

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

View file

@ -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
};