move GridView & GridOffset into separate grid module
This commit is contained in:
parent
f76a56f7b9
commit
c574bf6ad2
6 changed files with 12 additions and 39 deletions
|
@ -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 {
|
|
@ -13,10 +13,10 @@ use {
|
||||||
InnerViewPort
|
InnerViewPort
|
||||||
},
|
},
|
||||||
view::{
|
view::{
|
||||||
index::{IndexView, ImplIndexView},
|
index::IndexView
|
||||||
|
},
|
||||||
grid::{GridView, GridWindowIterator}
|
grid::{GridView, GridWindowIterator}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct GridOffset<V: GridView + ?Sized> {
|
pub struct GridOffset<V: GridView + ?Sized> {
|
|
@ -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}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -27,9 +27,9 @@ use {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
view::{
|
view::{
|
||||||
IndexView,
|
IndexView
|
||||||
grid::GridWindowIterator
|
},
|
||||||
}
|
grid::{GridView, GridWindowIterator}
|
||||||
},
|
},
|
||||||
super::{
|
super::{
|
||||||
TerminalStyle,
|
TerminalStyle,
|
||||||
|
|
|
@ -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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue