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: impl IntoFuture<IntoFuture = F>,
) -> Self
pub fn new_raw<F>( event_loop_waker: Waker, task: impl IntoFuture<IntoFuture = 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.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for UiTask<R>where
R: Freeze,
impl<R> !RefUnwindSafe for UiTask<R>
impl<R> Send for UiTask<R>where
R: Send,
impl<R> !Sync for UiTask<R>
impl<R> Unpin for UiTask<R>where
R: Unpin,
impl<R> !UnwindSafe for UiTask<R>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more