pub struct GeolocationMock { /* private fields */ }Expand description
Geolocation mock controller for simulating location changes
Implementations§
Source§impl GeolocationMock
impl GeolocationMock
Sourcepub fn set_position(&mut self, position: GeolocationPosition)
pub fn set_position(&mut self, position: GeolocationPosition)
Set current position directly
Sourcepub fn set_preset(&mut self, name: &str) -> bool
pub fn set_preset(&mut self, name: &str) -> bool
Set position from preset name
Returns true if preset exists and was set, false otherwise
Sourcepub fn add_preset(&mut self, name: &str, position: GeolocationPosition)
pub fn add_preset(&mut self, name: &str, position: GeolocationPosition)
Add a custom preset location
Sourcepub fn get_current_position(
&self,
) -> Result<GeolocationPosition, GeolocationError>
pub fn get_current_position( &self, ) -> Result<GeolocationPosition, GeolocationError>
Get current mocked position
Returns the position or an error based on mock state
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable geolocation
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if geolocation is enabled
Sourcepub fn set_permission(&mut self, granted: bool)
pub fn set_permission(&mut self, granted: bool)
Grant or deny geolocation permission
Sourcepub fn is_permission_granted(&self) -> bool
pub fn is_permission_granted(&self) -> bool
Check if permission is granted
Sourcepub fn simulate_error(&mut self, error: GeolocationError)
pub fn simulate_error(&mut self, error: GeolocationError)
Simulate a specific error
Sourcepub fn clear_error(&mut self)
pub fn clear_error(&mut self)
Clear error simulation
Sourcepub fn list_presets(&self) -> Vec<&str>
pub fn list_presets(&self) -> Vec<&str>
List all available presets
Sourcepub fn get_preset(&self, name: &str) -> Option<&GeolocationPosition>
pub fn get_preset(&self, name: &str) -> Option<&GeolocationPosition>
Get a preset by name
Sourcepub fn clear_position(&mut self)
pub fn clear_position(&mut self)
Clear current position
Trait Implementations§
Source§impl Clone for GeolocationMock
impl Clone for GeolocationMock
Source§fn clone(&self) -> GeolocationMock
fn clone(&self) -> GeolocationMock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GeolocationMock
impl Debug for GeolocationMock
Auto Trait Implementations§
impl Freeze for GeolocationMock
impl RefUnwindSafe for GeolocationMock
impl Send for GeolocationMock
impl Sync for GeolocationMock
impl Unpin for GeolocationMock
impl UnsafeUnpin for GeolocationMock
impl UnwindSafe for GeolocationMock
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().