use crate::api; use crate::config::Config; use crate::models::helper::*; #[derive(Debug)] pub struct WorldGeoT { config: Config, } impl Model for WorldGeoT { type FetchData = api::world_geo::FeatureCollection; const NAME: &'static str = "WorldGeo"; fn refresh(sr: &ModelHandle) -> Option { let sref = sr.clone(); let sd = sr.data(); sr.service().api_world_geo(&sd.config, move |result| { sref.set_received(result); }) } } #[derive(Clone, PartialEq, Eq, Debug)] pub struct WorldGeo(pub(super) ModelHandle); impl std::ops::Deref for WorldGeo { type Target = ModelHandle; fn deref(&self) -> &Self::Target { &self.0 } } impl WorldGeo { pub fn new(config: Config) -> Self { Self(ModelHandle::new( WorldGeoT { config }, (), )) } }