pub struct Plan {
pub objective: String,
pub steps: Vec<PlanStep>,
}Expand description
Execution plan
Fields§
§objective: StringPlan objective
steps: Vec<PlanStep>Step list
Implementations§
Source§impl Plan
impl Plan
Sourcepub fn new(objective: impl Into<String>, steps: Vec<PlanStep>) -> Self
pub fn new(objective: impl Into<String>, steps: Vec<PlanStep>) -> Self
Creates a new execution plan.
Sourcepub fn from_descriptions(
objective: impl Into<String>,
descs: Vec<String>,
) -> Self
pub fn from_descriptions( objective: impl Into<String>, descs: Vec<String>, ) -> Self
Constructs from a list of step descriptions (ids increment from 0)
Sourcepub fn next_pending(&self) -> Option<&PlanStep>
pub fn next_pending(&self) -> Option<&PlanStep>
The next pending step
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Whether all steps are completed
Sourcepub fn mark_completed(&mut self, id: usize, result: impl Into<String>)
pub fn mark_completed(&mut self, id: usize, result: impl Into<String>)
Marks the given step as completed and records the result.
Sourcepub fn mark_failed(&mut self, id: usize, error: impl Into<String>)
pub fn mark_failed(&mut self, id: usize, error: impl Into<String>)
Marks the given step as failed and records the error.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Plan
impl<'de> Deserialize<'de> for Plan
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 Plan
impl RefUnwindSafe for Plan
impl Send for Plan
impl Sync for Plan
impl Unpin for Plan
impl UnsafeUnpin for Plan
impl UnwindSafe for Plan
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