Skip to main content

Module geolocation

Module geolocation 

Source
Expand description

Geolocation manager — cross-platform state for the GPS/location surface (SUPER_PLAN_2 §1.5 + research/04 §3 + research/08 §6).

Three callers drive it:

  • The layout pass scans the styled DOM for GeolocationProbe NodeTypes. When the first probe appears the framework fires PermissionDiffEvent::Subscribe(Capability::Geolocation) and the platform backend starts a native CLLocationManager / LocationManager / geoclue subscription. The reverse on the last probe leaving.

  • The platform backend (dll/src/desktop/extra/geolocation/<plat>.rs) calls set_latest_fix(...) whenever the native subscription delivers an update. The manager debounces and records the most recent value; callbacks read it via CallbackInfo::get_geolocation_fix.

  • Callbacks read latest_fix() synchronously to render the map centre, decide whether to show “acquiring signal…”, etc.

No platform deps; no_std-friendly via alloc::collections::BTreeMap.

Structs§

GeolocationManager
Cross-platform geolocation state. One per App (the OS gives us a single per-process subscription, not per-window).
GeolocationProbeConfig
Configuration the user attaches to a NodeType::GeolocationProbe to tune the platform subscription. Maps to W3C PositionOptions (enableHighAccuracy + maximumAge + timeout).
LocationFix
One GPS / network-located fix. Mirrors the W3C GeolocationPosition shape so the future web backend lands without API churn.

Enums§

GeolocationDiffEvent
Diff event the layout pass emits when a probe appears or disappears. Symmetric to PermissionDiffEvent — drives the platform backend’s native subscribe / release calls.

Functions§

drain_location_fixes
Drain every fix parked by push_location_fix, in arrival order. Called once per layout pass; the caller applies them through GeolocationManager::set_latest_fix (the last one wins).
push_location_fix
Park a location fix delivered by a platform backend (in the dll). Thread-safe; recovers from a poisoned lock so one panicking applier can’t wedge delivery forever.