Skip to main content

QuitGate

Struct QuitGate 

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

The quit decision. One per app, in ShellState.

Implementations§

Source§

impl QuitGate

Source

pub fn new(bound: Option<Duration>) -> Self

None: drain off (today’s immediate quit). Some(bound): drain on, clamped to MAX_QUIT_DRAIN_BOUND.

Source

pub fn enabled(&self) -> bool

Source

pub fn bound(&self) -> Option<Duration>

Source

pub fn draining(&self) -> bool

True while a drain is in progress.

Source

pub fn request(&self, exiting: &AtomicBool, renderer_alive: bool) -> QuitStep

Decide a quit request. exiting is the shell’s exiting flag: once set (by rk_shell_finish_quit, rk_shell_quit or the bound) the exit path never prompts again. renderer_alive is false when no webview window remains, so nothing can answer.

Source

pub fn finish(&self)

The renderer finished (or the host is exiting): cancel the bound.

Source

pub fn arm_bound(self: &Arc<Self>, on_expiry: impl FnOnce() + Send + 'static)

Start the bound: after it elapses, on_expiry runs once unless QuitGate::finish ran first. The thread is short-lived and holds no AppHandle beyond what on_expiry captures.

Trait Implementations§

Source§

impl Debug for QuitGate

Source§

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

Formats the value using the given formatter. Read more

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> 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, 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.