pub struct Action<I, T: 'static> { /* private fields */ }Expand description
A handle to an async action created by use_action.
Call it with .call(...) to dispatch work, read results with .value(),
and check progress with .pending(). Implements Copy so it can be moved
into multiple event handlers freely.
Implementations§
Source§impl<I: 'static, O: 'static> Action<I, O>
impl<I: 'static, O: 'static> Action<I, O>
Sourcepub fn value(&self) -> Option<Result<ReadSignal<O>, CapturedError>>
pub fn value(&self) -> Option<Result<ReadSignal<O>, CapturedError>>
The result of the most recent call, if it has completed.
Returns None while the action is pending or has never been called.
Returns Some(Ok(signal)) on success or Some(Err(e)) on failure.
The returned ReadSignal is reactive — reading it in RSX will
subscribe the component to updates.
Source§impl<Out> Action<(), Out>
impl<Out> Action<(), Out>
Sourcepub fn call(&mut self) -> Dispatching<()> ⓘ
pub fn call(&mut self) -> Dispatching<()> ⓘ
Dispatch the action with no arguments.
Source§impl<A: 'static, Out> Action<(A,), Out>
impl<A: 'static, Out> Action<(A,), Out>
Sourcepub fn call(&mut self, A: A) -> Dispatching<()> ⓘ
pub fn call(&mut self, A: A) -> Dispatching<()> ⓘ
Dispatch the action with the given arguments.
Source§impl<A: 'static, B: 'static, Out> Action<(A, B), Out>
impl<A: 'static, B: 'static, Out> Action<(A, B), Out>
Sourcepub fn call(&mut self, A: A, B: B) -> Dispatching<()> ⓘ
pub fn call(&mut self, A: A, B: B) -> Dispatching<()> ⓘ
Dispatch the action with the given arguments.
Source§impl<A: 'static, B: 'static, C: 'static, Out> Action<(A, B, C), Out>
impl<A: 'static, B: 'static, C: 'static, Out> Action<(A, B, C), Out>
Sourcepub fn call(&mut self, A: A, B: B, C: C) -> Dispatching<()> ⓘ
pub fn call(&mut self, A: A, B: B, C: C) -> Dispatching<()> ⓘ
Dispatch the action with the given arguments.
Source§impl<A: 'static, B: 'static, C: 'static, D: 'static, Out> Action<(A, B, C, D), Out>
impl<A: 'static, B: 'static, C: 'static, D: 'static, Out> Action<(A, B, C, D), Out>
Sourcepub fn call(&mut self, A: A, B: B, C: C, D: D) -> Dispatching<()> ⓘ
pub fn call(&mut self, A: A, B: B, C: C, D: D) -> Dispatching<()> ⓘ
Dispatch the action with the given arguments.
Source§impl<A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, Out> Action<(A, B, C, D, E), Out>
impl<A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, Out> Action<(A, B, C, D, E), Out>
Sourcepub fn call(&mut self, A: A, B: B, C: C, D: D, E: E) -> Dispatching<()> ⓘ
pub fn call(&mut self, A: A, B: B, C: C, D: D, E: E) -> Dispatching<()> ⓘ
Dispatch the action with the given arguments.
Source§impl<A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static, Out> Action<(A, B, C, D, E, F), Out>
impl<A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static, Out> Action<(A, B, C, D, E, F), Out>
Sourcepub fn call(&mut self, A: A, B: B, C: C, D: D, E: E, F: F) -> Dispatching<()> ⓘ
pub fn call(&mut self, A: A, B: B, C: C, D: D, E: E, F: F) -> Dispatching<()> ⓘ
Dispatch the action with the given arguments.