|
1 | | -cfg_if::cfg_if! { |
2 | | - if #[cfg(windows)] { |
3 | | - mod windows; |
4 | | - pub use self::windows::*; |
5 | | - } else if #[cfg(target_family = "wasm")] { |
6 | | - mod wasm; |
7 | | - pub use self::wasm::*; |
| 1 | +#[cfg(windows)] |
| 2 | +mod windows; |
| 3 | +#[cfg(windows)] |
| 4 | +pub use self::windows::*; |
| 5 | + |
| 6 | +#[cfg(target_family = "wasm")] |
| 7 | +mod wasm; |
| 8 | +#[cfg(target_family = "wasm")] |
| 9 | +pub use self::wasm::*; |
| 10 | + |
| 11 | +#[cfg(not(any(target_family = "wasm", windows)))] |
| 12 | +mod unsupported { |
| 13 | + use std::sync::Arc; |
| 14 | + |
| 15 | + use crate::{Error, Event, Geocoordinates}; |
| 16 | + |
| 17 | + pub struct Geolocator {} |
| 18 | + |
| 19 | + impl Geolocator { |
| 20 | + /// Create a new Geolocator for the device. |
| 21 | + pub fn new() -> Result<Self, Error> { |
| 22 | + Err(Error::Unsupported) |
| 23 | + } |
| 24 | + } |
| 25 | + |
| 26 | + pub async fn get_coordinates(_geolocator: &Geolocator) -> Result<Geocoordinates, Error> { |
| 27 | + Err(Error::Unsupported) |
| 28 | + } |
| 29 | + |
| 30 | + pub fn set_power_mode( |
| 31 | + _geolocator: &mut Geolocator, |
| 32 | + _power_mode: crate::PowerMode, |
| 33 | + ) -> Result<(), Error> { |
| 34 | + Err(Error::Unsupported) |
| 35 | + } |
| 36 | + |
| 37 | + pub fn listen( |
| 38 | + _geolocator: &Geolocator, |
| 39 | + _callback: Arc<dyn Fn(Event) + Send + Sync>, |
| 40 | + ) -> Result<(), Error> { |
| 41 | + Err(Error::Unsupported) |
8 | 42 | } |
9 | 43 | } |
| 44 | + |
| 45 | +#[cfg(not(any(target_family = "wasm", windows)))] |
| 46 | +pub use self::unsupported::*; |
0 commit comments