pub struct CanPopRegistration(/* private fields */);Expand description
Proof-of-registration token returned by set_can_pop_provider.
The provider slot is single-registrant: at most one live provider exists
at a time, and a later set_can_pop_provider call replaces the earlier
registration without warning (the facade’s BackHandler is expected to be
constructed once, at the app root). This token is what makes that
replacement safe against out-of-order teardown: CanPopRegistration::unregister
clears the slot only if this registration is still the live one, so a
replaced (stale) handler’s on_cleanup can never clear a newer handler’s
provider out from under it. A future multi-handler/intercept design must
replace this slot with a stack — see the module docs.
Implementations§
Source§impl CanPopRegistration
impl CanPopRegistration
Sourcepub fn unregister(self)
pub fn unregister(self)
Unregister this provider iff it is still the live registration;
a stale token (already replaced by a newer set_can_pop_provider
call) is a harmless no-op, leaving the newer provider intact. Safe on
any thread (a non-UI thread’s slot is empty, so it no-ops).