Skip to main content

__location_async__

Function __location_async__ 

Source
pub async fn __location_async__(
    template: PageTemplate,
) -> Result<LocationData, LocationError>
Expand description

Async version of __location__.

Directly awaits the capture future — preferred when you are already running inside a Tokio async context so no extra OS thread needs to be spawned.

§Example

use toolkit_zero::location::browser::{__location_async__, PageTemplate, LocationError};

#[tokio::main]
async fn main() {
    match __location_async__(PageTemplate::default()).await {
        Ok(data) => println!("lat={:.6} lon={:.6}", data.latitude, data.longitude),
        Err(e) => eprintln!("error: {e}"),
    }
}