pub struct TaskContext {
pub task_id: String,
pub description: String,
pub upstream_results: Vec<(String, String)>,
pub upstream_errors: Vec<(String, String)>,
pub attempt: u32,
}Available on crate feature
tasks only.Expand description
Context provided to task execution functions
Contains the task description, upstream dependency results, and metadata so the executor can make informed decisions.
Fields§
§task_id: StringTask ID
description: StringTask description
upstream_results: Vec<(String, String)>Results from completed upstream dependencies (task_id → output)
upstream_errors: Vec<(String, String)>Errors from failed upstream dependencies (task_id → error)
attempt: u32Attempt number (1-based)
Implementations§
Source§impl TaskContext
impl TaskContext
Sourcepub fn new(
task_id: impl Into<String>,
description: impl Into<String>,
) -> TaskContext
pub fn new( task_id: impl Into<String>, description: impl Into<String>, ) -> TaskContext
Create a minimal context with no upstream results
Sourcepub fn with_upstream(
task_id: impl Into<String>,
description: impl Into<String>,
upstream_results: Vec<(String, String)>,
) -> TaskContext
pub fn with_upstream( task_id: impl Into<String>, description: impl Into<String>, upstream_results: Vec<(String, String)>, ) -> TaskContext
Create context with upstream results from a TaskManager snapshot
Sourcepub fn with_upstream_and_errors(
task_id: impl Into<String>,
description: impl Into<String>,
upstream_results: Vec<(String, String)>,
upstream_errors: Vec<(String, String)>,
) -> TaskContext
pub fn with_upstream_and_errors( task_id: impl Into<String>, description: impl Into<String>, upstream_results: Vec<(String, String)>, upstream_errors: Vec<(String, String)>, ) -> TaskContext
Create context with both upstream results and errors
Sourcepub fn format_upstream_context(&self) -> String
pub fn format_upstream_context(&self) -> String
Format upstream results as a context string for LLM injection
Sourcepub fn format_upstream_context_with_limit(&self, char_limit: usize) -> String
pub fn format_upstream_context_with_limit(&self, char_limit: usize) -> String
Format upstream results with a configurable character limit per result
Trait Implementations§
Source§impl Clone for TaskContext
impl Clone for TaskContext
Source§fn clone(&self) -> TaskContext
fn clone(&self) -> TaskContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TaskContext
impl RefUnwindSafe for TaskContext
impl Send for TaskContext
impl Sync for TaskContext
impl Unpin for TaskContext
impl UnsafeUnpin for TaskContext
impl UnwindSafe for TaskContext
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request