struct GeoclueTaskState {
session: Option<Session>,
generation: u64,
pending: Vec<PositionRequest>,
watches: HashMap<GeolocationWatchId, PositionWatch>,
}Expand description
The state of the GeoClue task.
Fields§
§session: Option<Session>§generation: u64Bumped whenever a new session is created, so that the run loop knows when its
subscription belongs to a client that no longer exists.
pending: Vec<PositionRequest>getCurrentPosition() calls waiting for the next position.
watches: HashMap<GeolocationWatchId, PositionWatch>watchPosition() calls, for as long as script wants them.
Implementations§
Source§impl GeoclueTaskState
impl GeoclueTaskState
async fn run(self, requests: UnboundedReceiver<Request>)
async fn handle_request(&mut self, request: Request)
async fn handle_update(&mut self, update: LocationUpdated)
Sourceasync fn report_current_position(&mut self)
async fn report_current_position(&mut self)
Deliver the position the client is already holding, if it has one. GeoClue points the
client’s Location property at / until the first fix.
Sourceasync fn report(
&mut self,
result: Result<GeolocationPositionData, GeolocationError>,
)
async fn report( &mut self, result: Result<GeolocationPositionData, GeolocationError>, )
Hand a result to everyone waiting for a position.
A consumer joining a client that already has a fix makes every watch see that position again. Firefox re-delivers its last position to new watchers for the same reason.
Sourcefn handle_failure(&mut self, error: Error)
fn handle_failure(&mut self, error: Error)
Report a D-Bus failure to script and tear the session down.
If GeoClue denied us because its agent had not connected yet, GetClient() keeps
returning the same rejected client, so the connection itself has to go for a later attempt
to have any chance. Firefox carries the same workaround for
https://gitlab.freedesktop.org/geoclue/geoclue/-/issues/143.
fn is_idle(&self) -> bool
Sourcefn wanted_accuracy(&self, wants_high_accuracy: bool) -> AccuracyLevel
fn wanted_accuracy(&self, wants_high_accuracy: bool) -> AccuracyLevel
The accuracy to request: the most any current consumer asked for.
Sourceasync fn open_or_update_session(
&mut self,
wants_high_accuracy: bool,
) -> Result<()>
async fn open_or_update_session( &mut self, wants_high_accuracy: bool, ) -> Result<()>
Make sure a started client exists, restarting it if the accuracy it was started with is no
longer the one we want since GeoClue only honours RequestedAccuracyLevel at Start().
async fn close_session(&mut self)
Trait Implementations§
Source§impl Default for GeoclueTaskState
impl Default for GeoclueTaskState
Source§fn default() -> GeoclueTaskState
fn default() -> GeoclueTaskState
Auto Trait Implementations§
impl !RefUnwindSafe for GeoclueTaskState
impl !UnwindSafe for GeoclueTaskState
impl Freeze for GeoclueTaskState
impl Send for GeoclueTaskState
impl Sync for GeoclueTaskState
impl Unpin for GeoclueTaskState
impl UnsafeUnpin for GeoclueTaskState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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 more