pub struct TaskResult {
pub task_id: TaskId,
pub status: TaskStatus,
pub messages: Vec<Message>,
pub artifacts: Vec<Artifact>,
pub error: Option<String>,
pub duration_ms: Option<u64>,
}Expand description
Result of a task execution.
Fields§
§task_id: TaskIdThe task ID.
status: TaskStatusFinal status.
messages: Vec<Message>Response messages.
artifacts: Vec<Artifact>Produced artifacts.
error: Option<String>Error message if failed.
duration_ms: Option<u64>Execution duration in milliseconds.
Implementations§
Source§impl TaskResult
impl TaskResult
Sourcepub fn success(task_id: impl Into<String>, messages: Vec<Message>) -> Self
pub fn success(task_id: impl Into<String>, messages: Vec<Message>) -> Self
Create a successful result.
Sourcepub fn failure(task_id: impl Into<String>, error: impl Into<String>) -> Self
pub fn failure(task_id: impl Into<String>, error: impl Into<String>) -> Self
Create a failed result.
Sourcepub fn with_artifacts(self, artifacts: Vec<Artifact>) -> Self
pub fn with_artifacts(self, artifacts: Vec<Artifact>) -> Self
Add artifacts to the result.
Sourcepub fn with_duration(self, duration_ms: u64) -> Self
pub fn with_duration(self, duration_ms: u64) -> Self
Set the duration.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if the result is successful.
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Check if the result is a failure.
Trait Implementations§
Source§impl Clone for TaskResult
impl Clone for TaskResult
Source§fn clone(&self) -> TaskResult
fn clone(&self) -> TaskResult
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 TaskResult
impl Debug for TaskResult
Source§impl<'de> Deserialize<'de> for TaskResult
impl<'de> Deserialize<'de> for TaskResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TaskResult
impl RefUnwindSafe for TaskResult
impl Send for TaskResult
impl Sync for TaskResult
impl Unpin for TaskResult
impl UnwindSafe for TaskResult
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