UiTaskWidget

Trait UiTaskWidget 

Source
pub trait UiTaskWidget<R> {
    // Required methods
    fn new<F>(
        target: Option<WidgetId>,
        task: impl IntoFuture<IntoFuture = F>,
    ) -> Self
       where F: Future<Output = R> + Send + 'static;
    fn new_boxed(
        target: Option<WidgetId>,
        task: Pin<Box<dyn Future<Output = R> + Send + 'static>>,
    ) -> Self;
}
Expand description

Integrate UiTask with widget updates.

Required Methods§

Source

fn new<F>( target: Option<WidgetId>, task: impl IntoFuture<IntoFuture = F>, ) -> Self
where F: Future<Output = R> + Send + 'static,

Create a UI bound future executor.

The task is inert and must be polled using update to start, and it must be polled every UiNode::update after that, in widgets the target can be set so that the update requests are received.

Source

fn new_boxed( target: Option<WidgetId>, task: Pin<Box<dyn Future<Output = R> + Send + 'static>>, ) -> Self

Like new, from an already boxed and pinned future.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<R> UiTaskWidget<R> for UiTask<R>

Source§

fn new<F>( target: Option<WidgetId>, task: impl IntoFuture<IntoFuture = F>, ) -> Self
where F: Future<Output = R> + Send + 'static,

Source§

fn new_boxed( target: Option<WidgetId>, task: Pin<Box<dyn Future<Output = R> + Send + 'static>>, ) -> Self

Implementors§