pub struct BackgroundTask { /* private fields */ }
Expand description
A BackgroundTask
does not actually execute any code, only act as a handler, primarily to query
the status of the task, and to cancel the task.
If you are looking to execute code in the background consider using rusts threading API, or if you
want the core to execute the task on a worker thread, use the crate::worker_thread
API.
NOTE: If you do not call BackgroundTask::finish
or BackgroundTask::cancel
the task will
persist even after it has been dropped.
Implementations§
source§impl BackgroundTask
impl BackgroundTask
pub fn new<S: BnStrCompatible>(initial_text: S, can_cancel: bool) -> Ref<Self>
pub fn can_cancel(&self) -> bool
pub fn is_cancelled(&self) -> bool
pub fn cancel(&self)
pub fn is_finished(&self) -> bool
pub fn finish(&self)
pub fn progress_text(&self) -> BnString
pub fn set_progress_text<S: BnStrCompatible>(&self, text: S)
pub fn running_tasks() -> Array<BackgroundTask>
Trait Implementations§
source§impl CoreArrayProvider for BackgroundTask
impl CoreArrayProvider for BackgroundTask
source§impl Hash for BackgroundTask
impl Hash for BackgroundTask
source§impl PartialEq for BackgroundTask
impl PartialEq for BackgroundTask
source§impl ToOwned for BackgroundTask
impl ToOwned for BackgroundTask
source§type Owned = Ref<BackgroundTask>
type Owned = Ref<BackgroundTask>
The resulting type after obtaining ownership.
source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more
impl Eq for BackgroundTask
impl Send for BackgroundTask
impl StructuralPartialEq for BackgroundTask
impl Sync for BackgroundTask
Auto Trait Implementations§
impl Freeze for BackgroundTask
impl RefUnwindSafe for BackgroundTask
impl Unpin for BackgroundTask
impl UnwindSafe for BackgroundTask
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