pub struct ServerJobTask<T> { /* private fields */ }Expand description
The outcome of a job run on the render thread: what
Compositor::invoke_server_job_async returns (a task upstream).
The handle is shared by its clones; the job completes it once, from the render thread. Continuations belong to the thread that created the task and run there: right away when the job completes on that thread, otherwise from its dispatcher.
Implementations§
Source§impl<T: Send + 'static> ServerJobTask<T>
impl<T: Send + 'static> ServerJobTask<T>
Sourcepub fn from_result(result: T) -> Self
pub fn from_result(result: T) -> Self
A task that has completed with result.
Sourcepub fn from_exception(error: ServerJobError) -> Self
pub fn from_exception(error: ServerJobError) -> Self
A task that has failed with error.
Sourcepub fn is_completed(&self) -> bool
pub fn is_completed(&self) -> bool
Whether the job has run.
Sourcepub fn is_completed_successfully(&self) -> bool
pub fn is_completed_successfully(&self) -> bool
Whether the job has run without an error.
Sourcepub fn is_faulted(&self) -> bool
pub fn is_faulted(&self) -> bool
Whether the job failed.
Sourcepub fn exception(&self) -> Option<ServerJobError>
pub fn exception(&self) -> Option<ServerJobError>
The error of a failed job.
Sourcepub fn take_result(&self) -> Option<Result<T, ServerJobError>>
pub fn take_result(&self) -> Option<Result<T, ServerJobError>>
Takes the result of a job that ran to completion: None while it
runs, and once taken; the error of a failed job.
Sourcepub fn on_completed(&self, continuation: impl FnOnce() + 'static)
pub fn on_completed(&self, continuation: impl FnOnce() + 'static)
Runs continuation once the job has run; right away if it has.
Called on the thread that created the task.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for ServerJobTask<T>
impl<T> !UnwindSafe for ServerJobTask<T>
impl<T> Freeze for ServerJobTask<T>
impl<T> Send for ServerJobTask<T>
impl<T> Sync for ServerJobTask<T>
impl<T> Unpin for ServerJobTask<T>
impl<T> UnsafeUnpin for ServerJobTask<T>where
Arc<ServerJobTaskShared<T>>: UnsafeUnpin,
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> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more