Skip to main content

LaunchedEffectScope

Struct LaunchedEffectScope 

Source
pub struct LaunchedEffectScope { /* private fields */ }

Implementations§

Source§

impl LaunchedEffectScope

Source

pub fn is_active(&self) -> bool

Source

pub fn runtime(&self) -> RuntimeHandle

Source

pub fn launch(&self, task: impl FnOnce(LaunchedEffectScope) + 'static)

Runs a follow-up LaunchedEffect task on the UI thread.

The provided closure executes on the runtime thread and may freely capture Rc/RefCell state. This must only be called from the UI thread, typically inside another effect callback.

Source

pub fn post_ui(&self, task: impl FnOnce() + 'static)

Posts UI-only work that will execute on the runtime thread.

The closure never crosses threads, so it may capture non-Send values. Callers must invoke this from the UI thread.

Source

pub fn launch_background<T, Work, Ui, Fut>(&self, work: Work, on_ui: Ui)
where T: Send + 'static, Work: FnOnce(CancelToken) -> Fut + Send + 'static, Fut: Future<Output = T> + Send + 'static, Ui: FnOnce(T) + 'static,

Runs background work and delivers results to the UI.

On native targets, work runs on a worker thread and its future is driven to completion there. On WASM, work runs as a task on the browser event loop. The on_ui continuation always runs on the runtime thread, so it may capture Rc/RefCell state safely.

Trait Implementations§

Source§

impl Clone for LaunchedEffectScope

Source§

fn clone(&self) -> LaunchedEffectScope

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

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.