pub struct TimedAsyncTask<T: ConditionalSend> { /* private fields */ }Expand description
A wrapper type around an async future with a timeout. The future may be executed
asynchronously by an TimedTaskRunner or
TimedTaskPool bevy system parameter.
Implementations§
Source§impl<T> TimedAsyncTask<T>where
T: ConditionalSend + 'static,
impl<T> TimedAsyncTask<T>where
T: ConditionalSend + 'static,
Sourcepub fn new<F>(dur: Duration, fut: F) -> Self
pub fn new<F>(dur: Duration, fut: F) -> Self
Create an async task from a future with a timeout.
Sourcepub fn split(
self,
) -> (Pin<Box<impl Future<Output = ()>>>, AsyncReceiver<Result<T, TimeoutError>>)
pub fn split( self, ) -> (Pin<Box<impl Future<Output = ()>>>, AsyncReceiver<Result<T, TimeoutError>>)
Split the task into a runnable future and receiver. This is a low-level operation and only useful for specific needs.
Sourcepub fn with_timeout(self, dur: Duration) -> Self
pub fn with_timeout(self, dur: Duration) -> Self
Replace the timeout for this task.
Sourcepub fn without_timeout(self) -> AsyncTask<T>
pub fn without_timeout(self) -> AsyncTask<T>
Remove the timeout for this task.
Trait Implementations§
Source§impl<T> Debug for TimedAsyncTask<T>
impl<T> Debug for TimedAsyncTask<T>
Source§impl<T, Fnc> From<Fnc> for TimedAsyncTask<T>
impl<T, Fnc> From<Fnc> for TimedAsyncTask<T>
Auto Trait Implementations§
impl<T> Freeze for TimedAsyncTask<T>
impl<T> !RefUnwindSafe for TimedAsyncTask<T>
impl<T> Send for TimedAsyncTask<T>
impl<T> !Sync for TimedAsyncTask<T>
impl<T> Unpin for TimedAsyncTask<T>
impl<T> !UnwindSafe for TimedAsyncTask<T>
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.