22 lines
471 B
Rust
Raw Normal View History

2023-02-25 14:12:18 -05:00
use this_algorithm::Address;
2023-02-25 11:14:25 -05:00
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
2023-02-25 14:12:18 -05:00
// fn alert(s: &str);
#[wasm_bindgen(js_namespace = console, js_name = log)]
fn log_str(s: &str);
2023-02-25 11:14:25 -05:00
}
#[wasm_bindgen]
2023-02-25 14:12:18 -05:00
pub fn address_lat_lon(lat: f64, lon: f64) -> Result<String, String> {
Address::from_lat_lon(lat, lon)
.map(|a| a.to_string())
.map_err(|e| e.to_string())
2023-02-25 11:14:25 -05:00
}
2023-02-25 14:12:18 -05:00
// #[wasm_bindgen]
// pub fn to_lat_lon(address: &str) -> Result>< {
// }