Skip to main content

Task

Struct Task 

Source
pub struct Task {
Show 15 fields pub id: String, pub description: String, pub status: TaskStatus, pub plan_id: Option<String>, pub parent_id: Option<String>, pub children: Vec<String>, pub depends_on: Vec<String>, pub priority: TaskPriority, pub assigned_to: Option<String>, pub iterations: u32, pub summary: Option<String>, pub created_at: i64, pub updated_at: i64, pub started_at: Option<i64>, pub completed_at: Option<i64>,
}
Expand description

A task being executed by an agent (supports tree structure)

Fields§

§id: String

Unique task ID

§description: String

Task description

§status: TaskStatus

Current status

§plan_id: Option<String>

Associated plan ID (links task to a plan)

§parent_id: Option<String>

Parent task ID (for tree structure)

§children: Vec<String>

Child task IDs

§depends_on: Vec<String>

Task IDs this task depends on (must complete before this can start)

§priority: TaskPriority

Task priority

§assigned_to: Option<String>

Assigned agent (if any)

§iterations: u32

Number of iterations executed

§summary: Option<String>

Result summary (when completed or failed)

§created_at: i64

Creation timestamp

§updated_at: i64

Last update timestamp

§started_at: Option<i64>

When the task was started (for time tracking)

§completed_at: Option<i64>

When the task was completed (for time tracking)

Implementations§

Source§

impl Task

Source

pub fn new<S: Into<String>>(id: S, description: S) -> Self

Create a new pending task

Source

pub fn new_for_plan<S: Into<String>>(id: S, description: S, plan_id: S) -> Self

Create a new task associated with a plan

Source

pub fn new_subtask<S: Into<String>>(id: S, description: S, parent_id: S) -> Self

Create a new task with a parent (subtask)

Source

pub fn start(&mut self)

Mark task as in progress

Source

pub fn complete<S: Into<String>>(&mut self, summary: S)

Mark task as completed

Source

pub fn duration_secs(&self) -> Option<i64>

Get task duration in seconds (if started and completed)

Source

pub fn elapsed_secs(&self) -> Option<i64>

Get elapsed time since task started (in seconds)

Source

pub fn fail<S: Into<String>>(&mut self, error: S)

Mark task as failed

Source

pub fn block(&mut self)

Mark task as blocked (waiting on dependencies)

Source

pub fn skip<S: Into<String>>(&mut self, reason: Option<S>)

Mark task as skipped

Source

pub fn increment_iteration(&mut self)

Increment iterations

Source

pub fn add_child(&mut self, child_id: String)

Add a child task ID

Source

pub fn add_dependency(&mut self, task_id: String)

Add a dependency

Source

pub fn has_dependencies(&self) -> bool

Check if task has any incomplete dependencies

Source

pub fn has_children(&self) -> bool

Check if task has children

Source

pub fn is_root(&self) -> bool

Check if task is a root task (no parent)

Source

pub fn set_priority(&mut self, priority: TaskPriority)

Set priority

Trait Implementations§

Source§

impl Clone for Task

Source§

fn clone(&self) -> Task

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Task

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Task

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Task

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Task

§

impl RefUnwindSafe for Task

§

impl Send for Task

§

impl Sync for Task

§

impl Unpin for Task

§

impl UnsafeUnpin for Task

§

impl UnwindSafe for Task

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,