[][src]Enum vgtk::UpdateAction

pub enum UpdateAction<C: Component> {
    Defer(Pin<Box<dyn Future<Output = C::Message> + 'static>>),

An action resulting from a Component::update().



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.

Defer(Pin<Box<dyn Future<Output = C::Message> + 'static>>)

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.


enum Message {

fn update(&mut self, message: Self::Message) -> UpdateAction<Self> {
    match message {
        Message::StartJob => async {
        Message::JobDone => UpdateAction::Render,


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, 

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.