#[non_exhaustive]pub struct TaskResult {
pub status: TaskResultStatus,
pub diff_ref: Option<String>,
pub branch: Option<String>,
pub pr_ref: Option<String>,
pub summary: Option<String>,
}Expand description
The actionable result of a task run, carried beside the Session snapshot.
Why: see the module docs — the ProposalEnvelope a calling assistant
renders needs something concrete (“branch, ref, pass/fail”), and a bare
session id is not that.
What: every field except status is nullable, and a producer that cannot
know one leaves it None rather than guessing. diff_ref is whatever ref
names where the change landed (this crate’s daemon reports a git tree
object SHA); branch is the checked-out branch; pr_ref is a PR URL or
number; summary is a one-line user-facing description. pr_ref is never
populated by this crate’s daemon — nothing in it opens a pull request — and
exists for a producer downstream that does.
Test: tests::task_result_round_trips_through_json,
tests::absent_optional_fields_deserialise_as_none,
tests::builders_set_each_field.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.status: TaskResultStatusPass/fail classification of the run.
diff_ref: Option<String>Where the change landed — a commit hash, tree SHA, branch name, or path.
branch: Option<String>The branch the run left checked out.
pr_ref: Option<String>A pull-request URL or number, when a producer opened one.
summary: Option<String>One-line user-facing description of what happened.
Implementations§
Source§impl TaskResult
impl TaskResult
Sourcepub fn new(status: TaskResultStatus) -> Self
pub fn new(status: TaskResultStatus) -> Self
A result carrying status and nothing else yet.
Why: #[non_exhaustive] deliberately blocks struct-literal
construction outside this crate, so this plus the with_* builders are
the whole construction surface — a field added later cannot break a
downstream caller.
What: every optional field starts None.
Test: tests::builders_set_each_field.
Sourcepub fn pending() -> Self
pub fn pending() -> Self
The result task.run returns immediately, before the run has finished.
Why: task.run is asynchronous — it mints the session, spawns the run
and returns. Reporting Pending with empty refs is the truthful
snapshot at that instant; the caller polls session.status for the
terminal one.
Test: crate::task::protocol::tests::task_run_response_carries_a_pending_result.
Sourcepub fn with_status(self, status: TaskResultStatus) -> Self
pub fn with_status(self, status: TaskResultStatus) -> Self
Replace the status, keeping every other field.
Why: a relaying caller learns the outcome from its child’s exit code
while the refs come from the child’s own reported result — the two
arrive from different places and must be composable.
Test: tests::builders_set_each_field.
Sourcepub fn with_diff_ref(self, diff_ref: Option<String>) -> Self
pub fn with_diff_ref(self, diff_ref: Option<String>) -> Self
Set diff_ref. None leaves it absent.
Test: tests::builders_set_each_field.
Sourcepub fn with_branch(self, branch: Option<String>) -> Self
pub fn with_branch(self, branch: Option<String>) -> Self
Set branch. None leaves it absent.
Test: tests::builders_set_each_field.
Sourcepub fn with_pr_ref(self, pr_ref: Option<String>) -> Self
pub fn with_pr_ref(self, pr_ref: Option<String>) -> Self
Set pr_ref. None leaves it absent.
Test: tests::builders_set_each_field.
Sourcepub fn with_summary(self, summary: Option<String>) -> Self
pub fn with_summary(self, summary: Option<String>) -> Self
Set summary. None leaves it absent.
Test: tests::builders_set_each_field.
Trait Implementations§
Source§impl Clone for TaskResult
impl Clone for TaskResult
Source§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>,
impl Eq for TaskResult
Source§impl PartialEq for TaskResult
impl PartialEq for TaskResult
Source§impl Serialize for TaskResult
impl Serialize for TaskResult
impl StructuralPartialEq for TaskResult
Auto Trait Implementations§
impl Freeze for TaskResult
impl RefUnwindSafe for TaskResult
impl Send for TaskResult
impl Sync for TaskResult
impl Unpin for TaskResult
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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