pub struct BackgroundTaskManager { /* private fields */ }Expand description
Manager for background tasks
Implementations§
Source§impl BackgroundTaskManager
impl BackgroundTaskManager
Sourcepub fn create_task(&self, model: String) -> String
pub fn create_task(&self, model: String) -> String
Create a new background task and return its ID
Sourcepub fn get_task(&self, id: &str) -> Option<BackgroundTask>
pub fn get_task(&self, id: &str) -> Option<BackgroundTask>
Get the current state of a task
Sourcepub fn get_response(&self, id: &str) -> Option<ResponseResource>
pub fn get_response(&self, id: &str) -> Option<ResponseResource>
Get the response resource for a task
Sourcepub fn mark_in_progress(&self, id: &str) -> bool
pub fn mark_in_progress(&self, id: &str) -> bool
Update task to in_progress state
Sourcepub fn mark_completed(&self, id: &str, response: ResponseResource) -> bool
pub fn mark_completed(&self, id: &str, response: ResponseResource) -> bool
Update task to completed state
Sourcepub fn mark_failed(&self, id: &str, error: ResponseError) -> bool
pub fn mark_failed(&self, id: &str, error: ResponseError) -> bool
Update task to failed state
Sourcepub fn request_cancel(&self, id: &str) -> bool
pub fn request_cancel(&self, id: &str) -> bool
Request cancellation of a task
Sourcepub fn is_cancel_requested(&self, id: &str) -> bool
pub fn is_cancel_requested(&self, id: &str) -> bool
Check if cancellation was requested for a task
Sourcepub fn mark_cancelled(&self, id: &str) -> bool
pub fn mark_cancelled(&self, id: &str) -> bool
Mark task as cancelled
Sourcepub fn delete_task(&self, id: &str) -> bool
pub fn delete_task(&self, id: &str) -> bool
Delete a task
Sourcepub fn list_tasks(&self) -> Vec<String>
pub fn list_tasks(&self) -> Vec<String>
List all task IDs
Sourcepub fn cleanup_old_tasks(&self, max_age_secs: u64)
pub fn cleanup_old_tasks(&self, max_age_secs: u64)
Clean up old completed/failed tasks older than the given duration (in seconds)
Trait Implementations§
Source§impl Debug for BackgroundTaskManager
impl Debug for BackgroundTaskManager
Source§impl Default for BackgroundTaskManager
impl Default for BackgroundTaskManager
Source§fn default() -> BackgroundTaskManager
fn default() -> BackgroundTaskManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BackgroundTaskManager
impl RefUnwindSafe for BackgroundTaskManager
impl Send for BackgroundTaskManager
impl Sync for BackgroundTaskManager
impl Unpin for BackgroundTaskManager
impl UnwindSafe for BackgroundTaskManager
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
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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> ⓘ
Converts
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> ⓘ
Converts
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§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.