[−][src]Enum vgtk::UpdateAction
An action resulting from a Component::update()
.
Variants
No action is necessary.
Use this when your update function didn't modify the component state in a way that alters the output of the view function.
Re-render the widget tree.
Use this when you've modified the component state and the component should call its view function and re-render itself to reflect the new state.
Run an async task and update again when it completes, passing the message
returned from the Future
to Component::update()
.
You should call UpdateAction::defer()
or rely on the From<Future>
implementation (see the example below) to construct this, rather than
trying to box up your Future
yourself.
Examples
enum Message { StartJob, JobDone, } fn update(&mut self, message: Self::Message) -> UpdateAction<Self> { match message { Message::StartJob => async { Message::JobDone }.into(), Message::JobDone => UpdateAction::Render, } }
Methods
impl<C: Component> UpdateAction<C>
[src]
pub fn defer(job: impl Future<Output = C::Message> + 'static) -> Self
[src]
Construct a deferred action given a Future
.
Trait Implementations
impl<C, F> From<F> for UpdateAction<C> where
C: Component,
F: Future<Output = C::Message> + 'static,
[src]
C: Component,
F: Future<Output = C::Message> + 'static,
Auto Trait Implementations
impl<C> !RefUnwindSafe for UpdateAction<C>
impl<C> !Send for UpdateAction<C>
impl<C> !Sync for UpdateAction<C>
impl<C> Unpin for UpdateAction<C>
impl<C> !UnwindSafe for UpdateAction<C>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,