#[non_exhaustive]pub struct JobInfo {
pub id: JobId,
pub command: String,
pub status: JobStatus,
pub output_file: Option<PathBuf>,
pub pid: Option<u32>,
pub exit_code: Option<i64>,
pub started_at: SystemTime,
pub finished_at: Option<SystemTime>,
pub pgids: Vec<u32>,
}Expand description
Information about a job for listing.
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.id: JobIdJob ID.
command: StringCommand description.
status: JobStatusCurrent status.
output_file: Option<PathBuf>Path to output file (if available).
pid: Option<u32>OS process ID (if this is a stopped/foreground process). Only ever
set for a Ctrl-Z-stopped foreground job — an embedder (no TTY) will
never see this populated; see Self::pgids for the surface that
actually covers embedder-spawned externals.
exit_code: Option<i64>The job’s exit code, once finished. None while Running/Stopped.
GH #243: previously the only way to learn how a job failed was to
string-parse failed:{code} off /v/jobs/N/status or block on
JobManager::wait.
started_at: SystemTimeWall-clock time the job started running (spawn/registration time).
Acquired via crate::clock::system_now, not SystemTime::now()
directly, so this stays valid on wasm32-unknown-unknown. On the wire
this is an RFC 3339 UTC string with millisecond precision
("2026-08-02T14:29:00.123Z") — see crate::rfc3339.
finished_at: Option<SystemTime>Wall-clock time the job finished, if it has. None while
Running/Stopped. Same RFC 3339 wire format as Self::started_at.
pgids: Vec<u32>OS process groups spawned by this job’s external children (so
kill -<sig> %N can signal them, and an embedder can see what’s
actually running). Empty for a pure-builtin job. GH #243: the real
surface for “what is this job doing”, since pid above almost never
applies to an embedder-created job.
Implementations§
Source§impl JobInfo
impl JobInfo
Sourcepub fn new(id: JobId, command: impl Into<String>, status: JobStatus) -> JobInfo
pub fn new(id: JobId, command: impl Into<String>, status: JobStatus) -> JobInfo
Create a JobInfo with the required fields; output_file/pid/
exit_code/finished_at default to None, pgids to empty,
and started_at to now (callers that track a job’s real start time —
i.e. JobManager — override it via Self::with_started_at). Chain
the with_* setters to fill in the rest.
#[non_exhaustive] blocks struct-literal construction from outside this
crate — this constructor plus the setters below are the replacement.
Sourcepub fn with_output_file(self, output_file: Option<PathBuf>) -> JobInfo
pub fn with_output_file(self, output_file: Option<PathBuf>) -> JobInfo
Set the output file path.
Sourcepub fn with_exit_code(self, exit_code: Option<i64>) -> JobInfo
pub fn with_exit_code(self, exit_code: Option<i64>) -> JobInfo
Set the exit code (see Self::exit_code).
Sourcepub fn with_started_at(self, started_at: SystemTime) -> JobInfo
pub fn with_started_at(self, started_at: SystemTime) -> JobInfo
Set the job’s real start time (see Self::started_at).
Sourcepub fn with_finished_at(self, finished_at: Option<SystemTime>) -> JobInfo
pub fn with_finished_at(self, finished_at: Option<SystemTime>) -> JobInfo
Set the job’s finish time (see Self::finished_at).
Sourcepub fn with_pgids(self, pgids: Vec<u32>) -> JobInfo
pub fn with_pgids(self, pgids: Vec<u32>) -> JobInfo
Set the recorded process groups (see Self::pgids).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for JobInfo
impl<'de> Deserialize<'de> for JobInfo
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<JobInfo, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<JobInfo, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for JobInfo
impl Serialize for JobInfo
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for JobInfo
Auto Trait Implementations§
impl Freeze for JobInfo
impl RefUnwindSafe for JobInfo
impl Send for JobInfo
impl Sync for JobInfo
impl Unpin for JobInfo
impl UnsafeUnpin for JobInfo
impl UnwindSafe for JobInfo
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<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> ⓘ
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
WrappingSpan::make_wrapped to wrap an AST node in a span.