pub struct Job { /* private fields */ }Expand description
One job of a shell.
Cloning shares the hold on the job.
Implementations§
Source§impl Job
impl Job
Sourcepub async fn info(&self) -> JobInfo
pub async fn info(&self) -> JobInfo
The job as the shell holds it now.
§Panics
Panics when the shell no longer holds the job, which a handle’s own hold on it prevents.
Sourcepub async fn wait(&self) -> Result<ScriptResult, JobWaitError>
pub async fn wait(&self) -> Result<ScriptResult, JobWaitError>
Waits for the job to end and returns what it printed and how it ended. The wait takes the job’s completion: a job read here owes its agent no turn, so the end it raises carries no pending completion.
§Errors
Returns an error when the job failed or its output could not be stored.
§Panics
Panics when the shell no longer holds the job, which a handle’s own hold on it prevents.
Sourcepub async fn read(
&self,
cursor: usize,
max_bytes: usize,
) -> Result<JobRead, String>
pub async fn read( &self, cursor: usize, max_bytes: usize, ) -> Result<JobRead, String>
Reads the job’s output past cursor, at most max_bytes of it; a
read that would return what the job’s last read returned is
JobRead::Unchanged.
§Errors
Returns an error when the shell does not hold the job.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Job
impl !Unpin for Job
impl !UnsafeUnpin for Job
impl !UnwindSafe for Job
impl Forget for Job
impl Freeze for Job
impl Move for Job
impl Send for Job
impl Sync for Job
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more