pub struct DeferredAction<A> { /* private fields */ }Expand description
Lazily constructs a dispatched action every time it is resolved.
Clones share the same Rc factory. Neither the factory nor this wrapper is
Send or Sync; it belongs to the UI thread. Factory panics propagate.
§Examples
use std::cell::Cell;
use std::rc::Rc;
use ailloli_ui_runtime::input::DeferredAction;
let calls = Rc::new(Cell::new(0));
let seen = calls.clone();
let action = DeferredAction::new(move || { seen.set(seen.get() + 1); seen.get() });
assert_eq!((action.resolve(), action.resolve()), (1, 2));Implementations§
Source§impl<A> DeferredAction<A>
Provides the operations defined for DeferredAction<A>.
impl<A> DeferredAction<A>
Provides the operations defined for DeferredAction<A>.
Trait Implementations§
Source§impl<A> Clone for DeferredAction<A>
Implements the Clone contract for DeferredAction<A>.
impl<A> Clone for DeferredAction<A>
Implements the Clone contract for DeferredAction<A>.
Source§impl<A: 'static> IntoClickAction<A> for DeferredAction<A>
Implements the IntoClickAction<A> contract for DeferredAction<A>.
impl<A: 'static> IntoClickAction<A> for DeferredAction<A>
Implements the IntoClickAction<A> contract for DeferredAction<A>.
Source§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.
Auto Trait Implementations§
impl<A> Freeze for DeferredAction<A>
impl<A> !RefUnwindSafe for DeferredAction<A>
impl<A> !Send for DeferredAction<A>
impl<A> !Sync for DeferredAction<A>
impl<A> Unpin for DeferredAction<A>
impl<A> !UnwindSafe for DeferredAction<A>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
Source§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.