pub struct Graph {
pub id: String,
/* private fields */
}Expand description
A graph of tasks that can be executed.
A Graph is immutable: it is assembled with GraphBuilder and validated
by GraphBuilder::build. Because nothing can change after construction,
lookups are plain HashMap reads with no locking.
Fields§
§id: StringImplementations§
Source§impl Graph
impl Graph
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Create an empty graph with the given id.
Useful as a placeholder (e.g. in tests). Real graphs are built with
GraphBuilder.
Sourcepub async fn execute_session(
&self,
session: &mut Session,
) -> Result<ExecutionResult>
pub async fn execute_session( &self, session: &mut Session, ) -> Result<ExecutionResult>
Execute the graph with session management.
Runs the session’s current task. If the task returns
NextAction::ContinueAndExecute, execution proceeds to the next task
within the same call, repeating until a task pauses, waits for input,
ends, or the configured max_execution_steps limit is hit.
Note: the session is only persisted by the caller (e.g.
crate::FlowRunner::run) after this method returns, so context
updates made by intermediate ContinueAndExecute steps are not durable
until the whole chain finishes.
Sourcepub fn find_next_task(
&self,
current_task_id: &str,
context: &Context,
) -> Option<String>
pub fn find_next_task( &self, current_task_id: &str, context: &Context, ) -> Option<String>
Find the next task based on edges and conditions
Sourcepub fn start_task_id(&self) -> Option<&str>
pub fn start_task_id(&self) -> Option<&str>
Get the start task ID
Auto Trait Implementations§
impl !RefUnwindSafe for Graph
impl !UnwindSafe for Graph
impl Freeze for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
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
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>
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>
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