pub struct UiTask<R>(/* private fields */);Expand description
Implementations§
source§impl<R> UiTask<R>
impl<R> UiTask<R>
sourcepub fn new_raw<F>(event_loop_waker: Waker, task: F) -> Self
pub fn new_raw<F>(event_loop_waker: Waker, task: F) -> Self
New task with already build event-loop waker.
App crate provides an integrated UiTaskWidget::new that creates the waker for widgets.
sourcepub fn update(&mut self) -> Option<&R>
pub fn update(&mut self) -> Option<&R>
Polls the future if needed, returns a reference to the result if the task is done.
This does not poll the future if the task is done.
§App Update
This method must be called only once per app update, if it is called more than once it will cause execution bugs,
futures like task::yield_now will not work correctly, variables will have old values when a new one
is expected and any other number of hard to debug issues will crop-up.
In debug builds this is validated and an error message is logged if incorrect updates are detected.
sourcepub fn is_ready(&self) -> bool
pub fn is_ready(&self) -> bool
Returns true if the task is done.
This does not poll the future.
sourcepub fn into_result(self) -> Result<R, Self>
pub fn into_result(self) -> Result<R, Self>
Returns the result if the task is completed.
This does not poll the future, you must call update to poll until a result is available,
then call this method to take ownership of the result.