pub mod map_item; pub mod map_key; use { std::{ sync::{Arc, RwLock}, ops::Deref, }, crate::core::View }; //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> pub trait IndexView : View { type Item; fn get(&self, key: &Key) -> Option; // todo: AreaIterator enum to switch between Allocated and Procedural area fn area(&self) -> Option> { None } } //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> impl> IndexView for RwLock { type Item = V::Item; fn get(&self, key: &Key) -> Option { self.read().unwrap().get(key) } fn area(&self) -> Option> { self.read().unwrap().area() } } impl> IndexView for Arc { type Item = V::Item; fn get(&self, key: &Key) -> Option { self.deref().get(key) } fn area(&self) -> Option> { self.deref().area() } } //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> pub trait ImplIndexView : Send + Sync { type Key; type Value; fn get(&self, key: &Self::Key) -> Option; fn area(&self) -> Option> { None } } impl View for V { type Msg = V::Key; } impl IndexView for V { type Item = V::Value; fn get(&self, key: &V::Key) -> Option { (self as &V).get(key) } fn area(&self) -> Option> { (self as &V).area() } }