garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

cartopolis-agent · 2026-11-30T19:49:56Z

style: cargo fmt over the data layers
crates/atlas/src/api.rs                         |  5 +-
 crates/atlas/src/feeds.rs                       | 63 +++++++++++++++++--------
 crates/cartopolis/src/systems/gui/feeds.rs      |  4 +-
 crates/cartopolis/src/systems/gui/lib_feeds.rs  |  4 +-
 crates/cartopolis/src/systems/gui/lib_layers.rs |  5 +-
 crates/cartopolis/src/systems/gui/mod.rs        |  6 +--
 crates/cartopolis/src/systems/mod.rs            | 11 ++---
 crates/geo/src/formats/feeds.rs                 |  5 +-
 crates/geo/src/formats/mod.rs                   |  2 +-
 9 files changed, 71 insertions(+), 34 deletions(-)

diff --git a/crates/atlas/src/api.rs b/crates/atlas/src/api.rs
index 0a0746f6..dd958cfc 100644
--- a/crates/atlas/src/api.rs
+++ b/crates/atlas/src/api.rs
@@ -768,7 +768,10 @@ async fn put_feed(
         Err(r) => return r,
     };
     if def.id != id {
-        return fail(StatusCode::BAD_REQUEST, "The id in the body is not the one in the path");
+        return fail(
+            StatusCode::BAD_REQUEST,
+            "The id in the body is not the one in the path",
+        );
     }
     let feeds = state.feeds.clone();
     let result = blocking(move || {
diff --git a/crates/atlas/src/feeds.rs b/crates/atlas/src/feeds.rs
index 1ad7f967..49d5a587 100644
--- a/crates/atlas/src/feeds.rs
+++ b/crates/atlas/src/feeds.rs
@@ -359,7 +359,9 @@ impl Feeds {
                         .filter(|l| l.state.source_revision != Some(r))
                         .map(|l| l.def.id),
                 ),
-                Err(error) => tracing::debug!(%dataset, %error, "could not read a dataset's revision"),
+                Err(error) => {
+                    tracing::debug!(%dataset, %error, "could not read a dataset's revision")
+                }
             }
         }
         out
@@ -468,8 +470,8 @@ impl Feeds {
                 id: def.id,
             })
             .collect();
-        let body = cartopolis_geo::formats::to_vec(&format::Index { feeds })
-            .map_err(|e| e.to_string())?;
+        let body =
+            cartopolis_geo::formats::to_vec(&format::Index { feeds }).map_err(|e| e.to_string())?;
         stamped::write_served(&self.site.join("index.json"), &body).map_err(|e| e.to_string())
     }
 
@@ -519,7 +521,9 @@ impl Feeds {
                         Ok(Err(error)) => {
                             tracing::warn!(feed = %id, %error, "data layer refresh failed; keeping the last copy");
                         }
-                        Err(error) => tracing::warn!(feed = %id, %error, "data layer refresh panicked"),
+                        Err(error) => {
+                            tracing::warn!(feed = %id, %error, "data layer refresh panicked")
+                        }
                     }
                 }
                 tokio::time::sleep(TICK).await;
@@ -562,10 +566,7 @@ fn get(url: &str, accept: &str) -> Result<Vec<u8>, String> {
 
 /// Ask the source for every row.
 fn fetch(def: &Def) -> Result<Vec<Row>, String> {
-    parse_sparql_json(&get(
-        &def.query_url(),
-        "application/sparql-results+json",
-    )?)
+    parse_sparql_json(&get(&def.query_url(), "application/sparql-results+json")?)
 }
 
 /// A TripleXL dataset as the Admin page offers it: who publishes it, under
@@ -604,13 +605,16 @@ pub fn dataset_of(url: &str) -> Result<String, String> {
     let rest = url
         .strip_prefix("https://")
         .ok_or("A dataset's address starts with https://.")?;
-    let (host, path) = rest.split_once('/').ok_or("That address names no dataset.")?;
+    let (host, path) = rest
+        .split_once('/')
+        .ok_or("That address names no dataset.")?;
     let parts: Vec<&str> = path.split('/').filter(|p| !p.is_empty()).collect();
     match parts.as_slice() {
         ["datasets", account, dataset, ..]
-            if [account, dataset]
-                .iter()
-                .all(|p| p.chars().all(|c| c.is_ascii_alphanumeric() || "-_.".contains(c))) =>
+            if [account, dataset].iter().all(|p| {
+                p.chars()
+                    .all(|c| c.is_ascii_alphanumeric() || "-_.".contains(c))
+            }) =>
         {
             Ok(format!("https://{host}/datasets/{account}/{dataset}"))
         }
@@ -991,7 +995,10 @@ mod tests {
         // RD: the Martinitoren.
         let (lat, lng) =
             place("<http://www.opengis.net/def/crs/EPSG/0/28992> POINT(233883 582065)").unwrap();
-        assert!((lat - 53.2193).abs() < 0.001 && (lng - 6.5682).abs() < 0.001, "{lat} {lng}");
+        assert!(
+            (lat - 53.2193).abs() < 0.001 && (lng - 6.5682).abs() < 0.001,
+            "{lat} {lng}"
+        );
         // CRS84 (and no IRI) is longitude first; EPSG 4326 latitude first.
         assert_eq!(place("POINT(6.5 53.2)"), Some((53.2, 6.5)));
         assert_eq!(
@@ -1014,10 +1021,16 @@ mod tests {
         assert_eq!(built.placed, 2, "the row with no place is left out");
         assert_eq!(built.values, vec!["overlaat", "stuw met klep"]);
         let all: Vec<&Record> = built.cells.values().flatten().collect();
-        let hoge = all.iter().find(|r| r.2 == "Hoge Noorderplantsoenstuw").unwrap();
+        let hoge = all
+            .iter()
+            .find(|r| r.2 == "Hoge Noorderplantsoenstuw")
+            .unwrap();
         assert_eq!(hoge.3, 0);
         assert_eq!(hoge.4, vec!["KST6211", "overlaat"]);
-        assert_eq!(hoge.5, "https://www.triplexl.nl/id/noorderzijlvest/stuw/KST6211");
+        assert_eq!(
+            hoge.5,
+            "https://www.triplexl.nl/id/noorderzijlvest/stuw/KST6211"
+        );
     }
 
     #[test]
@@ -1047,7 +1060,10 @@ mod tests {
         std::thread::sleep(Duration::from_millis(2));
         feeds.publish(&def(), Ok(moved)).unwrap();
         let after = stamped::read_cells(&manifest);
-        let restamped = after.iter().filter(|(c, s)| stamps.get(c) != Some(s)).count();
+        let restamped = after
+            .iter()
+            .filter(|(c, s)| stamps.get(c) != Some(s))
+            .count();
         assert_eq!(restamped, 1, "only the cell whose record changed");
     }
 
@@ -1136,9 +1152,18 @@ mod tests {
         let feeds = Feeds::new(&dir.path().join("data"), &dir.path().join("site"));
         feeds.save(&def()).unwrap();
         let s = feeds.refresh("nzv-stuwen").unwrap();
-        assert!(s.source_revision.is_some(), "the dataset's revision is kept");
-        assert!(feeds.moved(stamped::now_ms()).is_empty(), "nothing moved since");
-        eprintln!("live: {} rows, {} placed, {} cells, values {:?}", s.rows, s.placed, s.cells, s.values);
+        assert!(
+            s.source_revision.is_some(),
+            "the dataset's revision is kept"
+        );
+        assert!(
+            feeds.moved(stamped::now_ms()).is_empty(),
+            "nothing moved since"
+        );
+        eprintln!(
+            "live: {} rows, {} placed, {} cells, values {:?}",
+            s.rows, s.placed, s.cells, s.values
+        );
         assert!(s.cells > 10);
     }
 
diff --git a/crates/cartopolis/src/systems/gui/feeds.rs b/crates/cartopolis/src/systems/gui/feeds.rs
index 7db6c4f0..49024aff 100644
--- a/crates/cartopolis/src/systems/gui/feeds.rs
+++ b/crates/cartopolis/src/systems/gui/feeds.rs
@@ -189,7 +189,9 @@ impl crate::systems::stream_watch::StreamBusy for Feeds {
     /// Reading the index, a manifest, or a cell. Nothing is asked for with
     /// every layer off, so then it is never busy.
     fn stream_busy(&self) -> bool {
-        self.index_loading || !self.in_flight.is_empty() || self.manifests.values().any(|m| m.loading)
+        self.index_loading
+            || !self.in_flight.is_empty()
+            || self.manifests.values().any(|m| m.loading)
     }
 }
 
diff --git a/crates/cartopolis/src/systems/gui/lib_feeds.rs b/crates/cartopolis/src/systems/gui/lib_feeds.rs
index aca61b29..e666a1c7 100644
--- a/crates/cartopolis/src/systems/gui/lib_feeds.rs
+++ b/crates/cartopolis/src/systems/gui/lib_feeds.rs
@@ -205,7 +205,9 @@ fn card_view(s: Signal<CardState>, acts: &Rc<RefCell<Vec<Act>>>) -> View {
             );
             let name = c.feed.name.clone();
             let value: View = match value_label(&c) {
-                Some(v) => view! { <span style="color: var(--m-text-dim); font-weight: 400; text-transform: none; letter-spacing: 0">{format!("· {v}")}</span> },
+                Some(v) => {
+                    view! { <span style="color: var(--m-text-dim); font-weight: 400; text-transform: none; letter-spacing: 0">{format!("· {v}")}</span> }
+                }
                 None => View::Empty,
             };
             view! {
diff --git a/crates/cartopolis/src/systems/gui/lib_layers.rs b/crates/cartopolis/src/systems/gui/lib_layers.rs
index e1184465..83f378ea 100644
--- a/crates/cartopolis/src/systems/gui/lib_layers.rs
+++ b/crates/cartopolis/src/systems/gui/lib_layers.rs
@@ -141,7 +141,10 @@ impl Live {
             scenario_label: signal(scenario_label(dl)),
             feeds: signal(DataTab::default()),
             feed_on: Rc::new(RefCell::new(
-                dl.feeds.iter().map(|(id, on)| (id.clone(), signal(*on))).collect(),
+                dl.feeds
+                    .iter()
+                    .map(|(id, on)| (id.clone(), signal(*on)))
+                    .collect(),
             )),
             close: Rc::new(Cell::new(false)),
             reset: Rc::new(Cell::new(false)),
diff --git a/crates/cartopolis/src/systems/gui/mod.rs b/crates/cartopolis/src/systems/gui/mod.rs
index 132ed5c3..a9c90999 100644
--- a/crates/cartopolis/src/systems/gui/mod.rs
+++ b/crates/cartopolis/src/systems/gui/mod.rs
@@ -45,6 +45,7 @@ pub mod dock;
 pub mod external_signin;
 pub mod facade_check;
 pub mod faces;
+pub mod feeds;
 pub mod floor_picker;
 pub mod hud;
 pub mod icons;
@@ -85,6 +86,8 @@ pub mod lib_driver;
 #[cfg(feature = "ui-lib")]
 pub mod lib_face_viewfinder;
 #[cfg(feature = "ui-lib")]
+pub mod lib_feeds;
+#[cfg(feature = "ui-lib")]
 pub mod lib_host;
 #[cfg(feature = "ui-lib")]
 pub mod lib_interact;
@@ -123,8 +126,6 @@ pub mod lib_places;
 #[cfg(feature = "ui-lib")]
 pub mod lib_plans;
 #[cfg(feature = "ui-lib")]
-pub mod lib_feeds;
-#[cfg(feature = "ui-lib")]
 pub mod lib_poi_card;
 #[cfg(all(feature = "ui-lib", not(target_arch = "wasm32")))]
 pub mod lib_release_approval;
@@ -183,7 +184,6 @@ pub mod place_card;
 pub mod place_names;
 pub mod place_pins;
 pub mod plans;
-pub mod feeds;
 pub mod scenario;
 pub mod script_editor;
 pub mod settings;
diff --git a/crates/cartopolis/src/systems/mod.rs b/crates/cartopolis/src/systems/mod.rs
index 18016b65..cf209285 100644
--- a/crates/cartopolis/src/systems/mod.rs
+++ b/crates/cartopolis/src/systems/mod.rs
@@ -61,9 +61,9 @@ pub use cartopolis_geo::{
 pub use gui::{
     action_ring, app_update, avatar_designer, bookmarks, building_card, chat, cosmos, data_layers,
     design_room, discs, dismiss, dock, facade_check, faces, feeds, floor_picker, hud, icons,
-    layer_tiles,
-    map_osd, model_library, motion, onscreen_keyboard, place_card, place_names, place_pins, plans,
-    scenario, script_editor, settings, splash, theme, ui, ui_input, ui_theme, welcome, zoom_rail,
+    layer_tiles, map_osd, model_library, motion, onscreen_keyboard, place_card, place_names,
+    place_pins, plans, scenario, script_editor, settings, splash, theme, ui, ui_input, ui_theme,
+    welcome, zoom_rail,
 };
 // Settings drawn by the component library, beside egui (`ui-probe`).
 #[cfg(all(feature = "ui-lib", feature = "comms", not(target_arch = "wasm32")))]
@@ -85,9 +85,8 @@ pub use gui::{
 pub use gui::{
     lib_action_ring, lib_app_update, lib_avatar, lib_chrome, lib_cosmos, lib_design_room,
     lib_driver, lib_face_viewfinder, lib_feeds, lib_interact, lib_locate, lib_main_menu,
-    lib_map_osd,
-    lib_models, lib_pins, lib_place_names, lib_plans, lib_poi_card, lib_satellite_menu,
-    lib_scenario, lib_scenario_map, lib_script, lib_splash, lib_walk_guide,
+    lib_map_osd, lib_models, lib_pins, lib_place_names, lib_plans, lib_poi_card,
+    lib_satellite_menu, lib_scenario, lib_scenario_map, lib_script, lib_splash, lib_walk_guide,
 };
 #[cfg(all(feature = "ui-lib", feature = "comms"))]
 pub use gui::{
diff --git a/crates/geo/src/formats/feeds.rs b/crates/geo/src/formats/feeds.rs
index 395e431d..b0b545ca 100644
--- a/crates/geo/src/formats/feeds.rs
+++ b/crates/geo/src/formats/feeds.rs
@@ -105,7 +105,10 @@ mod tests {
         let cell = parse_cell(CELL).unwrap();
         assert_eq!(cell.records[0].2, "Hoge Noorderplantsoenstuw");
         assert_eq!(cell.records[0].4, vec!["KST6211", "overlaat"]);
-        assert_eq!(String::from_utf8(super::super::to_vec(&cell).unwrap()).unwrap(), CELL);
+        assert_eq!(
+            String::from_utf8(super::super::to_vec(&cell).unwrap()).unwrap(),
+            CELL
+        );
     }
 
     #[test]
diff --git a/crates/geo/src/formats/mod.rs b/crates/geo/src/formats/mod.rs
index 4c2b9c03..2aede4da 100644
--- a/crates/geo/src/formats/mod.rs
+++ b/crates/geo/src/formats/mod.rs
@@ -35,8 +35,8 @@ pub mod brp;
 pub mod coverage;
 pub mod decks;
 pub mod dikes;
-pub mod feeds;
 pub mod facades;
+pub mod feeds;
 pub mod galaxies;
 pub mod lod22;
 pub mod osm_buildings;