pub struct GeolocationManager {
pub latest_fix: Option<LocationFix>,
pub active_config: Option<GeolocationProbeConfig>,
pub last_error: Option<LocationError>,
/* private fields */
}Expand description
Cross-platform geolocation state. One per App (the OS gives us
a single per-process subscription, not per-window).
Fields§
§latest_fix: Option<LocationFix>Most recent fix from the platform backend, or None until the
first native sample arrives (or None again after a Release).
active_config: Option<GeolocationProbeConfig>Active probe config — set on each Subscribe / Reconfigure, cleared on Release.
last_error: Option<LocationError>Most recent backend error (subscription failed / timed out /
revoked), or None. Cleared on the next successful fix (MWA-A1b).
Implementations§
Source§impl GeolocationManager
impl GeolocationManager
pub fn new() -> Self
pub const fn latest_fix(&self) -> Option<LocationFix>
pub const fn refcount(&self) -> u32
Sourcepub fn set_latest_fix(&mut self, fix: LocationFix) -> bool
pub fn set_latest_fix(&mut self, fix: LocationFix) -> bool
Platform backend writes the freshly-received fix. Returns true if the fix actually advanced (different from the previous one) so the caller can mark the window dirty for relayout.
Compared via bit-pattern equality so missing fields (encoded as
f32::NAN) compare equal — PartialEq returns false on
NaN-vs-NaN, which would make every fix look “changed” even
when nothing actually moved.
Sourcepub fn set_last_error(&mut self, error: LocationError)
pub fn set_last_error(&mut self, error: LocationError)
Platform backend reports a subscription error (MWA-A1b). Always raises the error-event flag — repeated errors each answer a live subscription and callbacks should hear every one.
Sourcepub const fn clear_pending_event(&mut self)
pub const fn clear_pending_event(&mut self)
Clear the pending-event flags (fix + error). The dll calls this after the event pass has collected the geolocation events.
Sourcepub const fn has_active_subscription(&self) -> bool
pub const fn has_active_subscription(&self) -> bool
true while at least one GeolocationProbe is mounted — the
capability pump keeps its drain timer armed while this holds, so
fixes parked by the native backend reach callbacks without waiting
for unrelated input (MWA-A1 arming signal).
Sourcepub fn take_pending_events(&mut self) -> Vec<GeolocationDiffEvent>
pub fn take_pending_events(&mut self) -> Vec<GeolocationDiffEvent>
Drain queued diff events. Platform backend calls this once per frame.
Sourcepub fn diff_layout<F>(&mut self, for_each_probe: F)
pub fn diff_layout<F>(&mut self, for_each_probe: F)
Diff entry point. The layout pass walks the styled DOM for
GeolocationProbe nodes and feeds each (config, node_id)
pair to the closure. The manager bumps the refcount, watches
for config drift, and enqueues the right Subscribe / Release /
Reconfigure event.
Trait Implementations§
Source§impl Clone for GeolocationManager
impl Clone for GeolocationManager
Source§fn clone(&self) -> GeolocationManager
fn clone(&self) -> GeolocationManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GeolocationManager
impl Debug for GeolocationManager
Source§impl Default for GeolocationManager
impl Default for GeolocationManager
Source§fn default() -> GeolocationManager
fn default() -> GeolocationManager
Source§impl EventProvider for GeolocationManager
impl EventProvider for GeolocationManager
Source§fn get_pending_events(&self, timestamp: Instant) -> Vec<SyntheticEvent>
fn get_pending_events(&self, timestamp: Instant) -> Vec<SyntheticEvent>
Yield a window-level GeolocationFix event when a fix advanced since
the last drain (target = root; read the value via
CallbackInfo::get_geolocation_fix inside the callback). Mirrors the
sensor / gamepad providers; before MWA-A1 nothing ever produced
EventType::GeolocationFix, so fix callbacks could never fire.
Source§impl PartialEq for GeolocationManager
impl PartialEq for GeolocationManager
impl StructuralPartialEq for GeolocationManager
Auto Trait Implementations§
impl Freeze for GeolocationManager
impl RefUnwindSafe for GeolocationManager
impl Send for GeolocationManager
impl Sync for GeolocationManager
impl Unpin for GeolocationManager
impl UnsafeUnpin for GeolocationManager
impl UnwindSafe for GeolocationManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more