Job

Struct Job 

Source
pub struct Job {
    pub id: usize,
    pub command_line: String,
    pub state: JobState,
    /* private fields */
}
Expand description

Encapsulates a set of processes managed by the shell as a single unit.

Fields§

§id: usize

The shell-internal ID of the job.

§command_line: String

The command line of the job.

§state: JobState

The current operational state of the job.

Implementations§

Source§

impl Job

Source

pub fn to_pid_style_string(&self) -> String

Returns a pid-style string for the job.

Source

pub fn annotation(&self) -> JobAnnotation

Returns the annotation of the job.

Source

pub fn command_name(&self) -> &str

Returns the command name of the job.

Source

pub const fn is_current(&self) -> bool

Returns whether the job is the current job.

Source

pub const fn is_prev(&self) -> bool

Returns whether the job is the previous job.

Source

pub fn poll_done( &mut self, ) -> Result<Option<Result<ExecutionResult, Error>>, Error>

Polls whether the job has completed.

Source

pub async fn wait(&mut self) -> Result<ExecutionResult, Error>

Waits for the job to complete.

Source

pub fn move_to_background(&mut self) -> Result<(), Error>

Moves the job to execute in the background.

Source

pub fn move_to_foreground(&mut self) -> Result<(), Error>

Moves the job to execute in the foreground.

Source

pub fn kill(&self, signal: TrapSignal) -> Result<(), Error>

Kills the job.

§Arguments
  • signal - The signal to send to the job.
Source

pub fn representative_pid(&self) -> Option<i32>

Tries to retrieve a “representative” pid for the job.

Source

pub fn process_group_id(&self) -> Option<i32>

Tries to retrieve the process group ID (PGID) of the job.

Trait Implementations§

Source§

impl Display for Job

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Job

§

impl !RefUnwindSafe for Job

§

impl Send for Job

§

impl Sync for Job

§

impl Unpin for Job

§

impl !UnwindSafe for Job

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more