Skip to main content

MobileSessionLifecycle

Struct MobileSessionLifecycle 

Source
pub struct MobileSessionLifecycle { /* private fields */ }
Expand description

Generation-stamped mobile host session lifecycle coordinator guarding same-process exit and re-entry races.

Implementations§

Source§

impl MobileSessionLifecycle

Generation-stamped same-process session lifecycle helpers for MobileSessionLifecycle.

Source

pub fn begin_session(&mut self, owner_id: u64) -> u64

Registers a new host activity or scene session, resetting transient flags and returning its monotonic generation.

§Arguments
  • &Self - Mutable lifecycle coordinator.
  • u64 - Unique identifier of the newly created host activity or scene.
§Returns
  • u64 - Monotonic session generation assigned to owner_id.
Source

pub fn activate_session(&mut self, owner_id: u64, session_gen: u64) -> bool

Re-claims bridge ownership when owner_id resumes and is either the latest session or the previous owner cleared.

§Arguments
  • &Self - Mutable lifecycle coordinator.
  • u64 - Resuming host activity or scene identifier.
  • u64 - Generation originally assigned to owner_id.
§Returns
  • bool - true when owner_id holds active bridge ownership after the call.
Source

pub fn end_session(&mut self, owner_id: u64, session_gen: u64) -> bool

Ends owner_id’s session only when (owner_id, session_gen) still owns the bridge, preventing delayed teardown races.

§Arguments
  • &Self - Mutable lifecycle coordinator.
  • u64 - Destroying host activity or scene identifier.
  • u64 - Generation originally assigned to owner_id.
§Returns
  • bool - true when ownership belonged to owner_id and was cleared; false when a newer session already replaced it.
Source

pub fn is_active_owner(&self, owner_id: u64, session_gen: u64) -> bool

Returns true when (owner_id, session_gen) is currently the authoritative foreground bridge owner.

§Arguments
  • &Self - Lifecycle coordinator reference.
  • u64 - Host activity or scene identifier.
  • u64 - Generation assigned to owner_id.
§Returns
  • bool - true when owner_id matches the active generation and owner.
Source

pub fn active_session_generation(&self) -> u64

Returns the current monotonic session generation.

§Arguments
  • &Self - Lifecycle coordinator reference.
§Returns
  • u64 - Current session generation.
Source

pub fn active_owner_id(&self) -> u64

Returns the currently active bridge owner identifier (0 when no activity or scene is active).

§Arguments
  • &Self - Lifecycle coordinator reference.
§Returns
  • u64 - Active host owner identifier.
Source

pub fn loop_generation(&self) -> u64

Returns the current VSync loop generation counter.

§Arguments
  • &Self - Lifecycle coordinator reference.
§Returns
  • u64 - Active VSync callback generation.
Source

pub fn is_loop_running(&self) -> bool

Returns whether the VSync render loop is currently active.

§Arguments
  • &Self - Lifecycle coordinator reference.
§Returns
  • bool - true when the VSync frame pump is running.
Source

pub fn is_surface_attached(&self) -> bool

Returns whether a native rendering surface is currently attached.

§Arguments
  • &Self - Lifecycle coordinator reference.
§Returns
  • bool - true when the native surface is valid and bound.
Source

pub fn should_recreate_handle(&self) -> bool

Returns true when an existing activity resumed after Terminate or exit request and must recreate its native App handle.

§Arguments
  • &Self - Lifecycle coordinator reference.
§Returns
  • bool - true when the native handle is no longer running or was terminated.
Source

pub fn on_surface_created(&mut self)

Marks the active session’s surface attached and recreates the live running state if needed.

§Arguments
  • &Self - Mutable lifecycle coordinator.
Source

pub fn on_surface_destroyed(&mut self, wid: WindowId) -> Vec<WindowEvent>

Marks the active surface detached and emits PointerCancel events for any active contacts.

§Arguments
  • &Self - Mutable lifecycle coordinator.
  • WindowId - Window whose surface detached.
§Returns
  • Vec<WindowEvent> - Cancellation events for any dangling touch contacts.
Source

pub fn on_resume(&mut self) -> u64

Transitions the active session to resumed foreground state and returns the unique VSync loop generation.

§Arguments
  • &Self - Mutable lifecycle coordinator.
§Returns
  • u64 - Unique VSync loop generation preventing duplicate frame callbacks.
Source

pub fn on_pause(&mut self, wid: WindowId) -> Vec<WindowEvent>

Pauses the active VSync loop, advances the loop generation to invalidate in-flight callbacks, and cancels active touches.

§Arguments
  • &Self - Mutable lifecycle coordinator.
  • WindowId - Target window handle.
§Returns
  • Vec<WindowEvent> - Cancellation events for any active touch contacts.
Source

pub fn on_background(&mut self)

Marks the active session background-frozen with the VSync loop halted.

§Arguments
  • &Self - Mutable lifecycle coordinator.
Source

pub fn on_terminate(&mut self)

Records a double-back exit request or OS termination so subsequent re-entry recreates a fresh native handle.

§Arguments
  • &Self - Mutable lifecycle coordinator.
Source

pub fn touch_tracker(&self) -> &TouchPointerTracker

Returns an immutable reference to the session’s TouchPointerTracker.

§Arguments
  • &Self - Lifecycle coordinator reference.
§Returns
  • &TouchPointerTracker - Active touch tracker.
Source

pub fn touch_tracker_mut(&mut self) -> &mut TouchPointerTracker

Returns a mutable reference to the session’s TouchPointerTracker.

§Arguments
  • &Self - Mutable lifecycle coordinator.
§Returns
  • &mut TouchPointerTracker - Mutable touch tracker.
Source§

impl MobileSessionLifecycle

Source

pub fn get_mut_session_generation(&mut self) -> &mut u64

Source

pub fn get_mut_active_owner_id(&mut self) -> &mut u64

Source

pub fn get_mut_loop_generation(&mut self) -> &mut u64

Source

pub fn get_mut_surface_attached(&mut self) -> &mut bool

Source

pub fn get_mut_loop_running(&mut self) -> &mut bool

Source

pub fn get_mut_app_running(&mut self) -> &mut bool

Source

pub fn get_mut_background_frozen(&mut self) -> &mut bool

Source

pub fn get_mut_terminated(&mut self) -> &mut bool

Trait Implementations§

Source§

impl Clone for MobileSessionLifecycle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MobileSessionLifecycle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MobileSessionLifecycle

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for MobileSessionLifecycle

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MobileSessionLifecycle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.