pub struct GeolocationManager {
pub latest_fix: Option<LocationFix>,
pub active_config: Option<GeolocationProbeConfig>,
/* 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.
Implementations§
Source§impl GeolocationManager
impl GeolocationManager
pub fn new() -> Self
pub fn latest_fix(&self) -> Option<LocationFix>
pub 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 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 PartialEq for GeolocationManager
impl PartialEq for GeolocationManager
Source§fn eq(&self, other: &GeolocationManager) -> bool
fn eq(&self, other: &GeolocationManager) -> bool
self and other values to be equal, and is used by ==.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