[−][src]Struct azul_core::task::Task
A Task
is a seperate thread that is owned by the framework.
In difference to a Thread
, you don't have to await()
the result of a Task
,
you can just hand the task to the framework (via AppResources::add_task
) and
the framework will automatically update the UI when the task is finished.
This is useful to offload actions such as loading long files, etc. to a background thread.
Azul will join the thread automatically after it is finished (joining won't block the UI).
Fields
after_completion_timer: Option<Timer>
Timer that will run directly after this task is completed.
Implementations
impl Task
[src]
pub fn new<U: Send + 'static>(
data: Arc<Mutex<U>>,
callback: TaskCallback<U>
) -> Self
[src]
data: Arc<Mutex<U>>,
callback: TaskCallback<U>
) -> Self
Creates a new task from a callback and a set of input data - which has to be wrapped in an Arc<Mutex<T>>>
.
pub fn then(self, timer: Timer) -> Self
[src]
Stores a Timer
that will run after the task has finished.
Often necessary to "clean up" or copy data from the background task into the UI.
pub fn is_finished(&self) -> bool
[src]
Returns true if the task has been finished, false otherwise
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl !UnwindSafe for Task
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,