Skip to main content

Module location

Module location 

Source
Expand description

Geographic location acquisition API.

This module serves as the authoritative entry point for all geographic coordinate retrieval within the toolkit. It is structured around the concept of interchangeable acquisition strategies: each sub-module implements a self-contained mechanism for obtaining location data, allowing new strategies to be introduced incrementally without disrupting the existing public interface.

§Acquisition strategies

Sub-moduleMechanismPlatform support
browserInstantiates a transient local HTTP server and directs the
system’s default browser to a consent page, which acquires coordinates
through the standardised Web Geolocation API.Platform-independent

§Feature flag

This module is compiled when the location (or location-native) feature is enabled:

[dependencies]
toolkit-zero = { version = "...", features = ["location"] }

Modules§

backend_deps
Re-exports all backend dependencies used by the location module and its sub-module (browser).
browser
The most simplest of location mechanism that uses the native browser to fetch location info about current device. This module provides __location__, a versatile function that works with both sync and async contexts.