pub struct BackgroundTask {
pub id: String,
pub prompt: String,
pub origin: TaskOrigin,
pub status: TaskStatus,
pub started_at: DateTime<Utc>,
pub completed_at: Option<DateTime<Utc>>,
}Expand description
Background task with origin tracking
Fields§
§id: StringUnique task ID
prompt: StringTask prompt/description
origin: TaskOriginWhere to route results
status: TaskStatusCurrent status
started_at: DateTime<Utc>When the task started
completed_at: Option<DateTime<Utc>>When the task completed (if applicable)
Implementations§
Source§impl BackgroundTask
impl BackgroundTask
Sourcepub fn new(prompt: impl Into<String>, origin: TaskOrigin) -> BackgroundTask
pub fn new(prompt: impl Into<String>, origin: TaskOrigin) -> BackgroundTask
Create a new background task
Sourcepub fn mark_running(&mut self)
pub fn mark_running(&mut self)
Mark as running
Sourcepub fn mark_completed(&mut self, result: impl Into<String>)
pub fn mark_completed(&mut self, result: impl Into<String>)
Mark as completed
Sourcepub fn mark_failed(&mut self, error: impl Into<String>)
pub fn mark_failed(&mut self, error: impl Into<String>)
Mark as failed
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Check if task is finished
Trait Implementations§
Source§impl Clone for BackgroundTask
impl Clone for BackgroundTask
Source§fn clone(&self) -> BackgroundTask
fn clone(&self) -> BackgroundTask
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BackgroundTask
impl Debug for BackgroundTask
Source§impl<'de> Deserialize<'de> for BackgroundTask
impl<'de> Deserialize<'de> for BackgroundTask
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BackgroundTask, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BackgroundTask, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for BackgroundTask
impl Serialize for BackgroundTask
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for BackgroundTask
impl RefUnwindSafe for BackgroundTask
impl Send for BackgroundTask
impl Sync for BackgroundTask
impl Unpin for BackgroundTask
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage