Skip to main content

Cmd

Enum Cmd 

Source
pub enum Cmd {
    Cd {
        cmd: Command,
        stderr: StderrTarget,
    },
    Echo {
        cmd: Command,
        stdout: StdoutTarget,
        stderr: StderrTarget,
    },
    Exit(u8),
    Type {
        cmd: Command,
        stdout: StdoutTarget,
        stderr: StderrTarget,
    },
    Exec {
        cmd: Command,
        stdout: StdoutTarget,
        stderr: StderrTarget,
    },
    Pwd {
        stdout: StdoutTarget,
        stderr: StderrTarget,
    },
    History {
        cmd: Command,
        stdout: StdoutTarget,
        stderr: StderrTarget,
    },
    Unknown {
        cmd: Command,
        stderr: StderrTarget,
    },
}

Variants§

§

Cd

Fields

§

Echo

Fields

§

Exit(u8)

§

Type

Fields

§

Exec

Fields

§

Pwd

Fields

§

History

Fields

§

Unknown

Fields

Implementations§

Source§

impl Cmd

Source

pub const fn is_cd(&self) -> bool

Returns true if the enum is Cmd::Cd otherwise false

Source

pub const fn is_echo(&self) -> bool

Returns true if the enum is Cmd::Echo otherwise false

Source

pub const fn is_exit(&self) -> bool

Returns true if the enum is Cmd::Exit otherwise false

Source

pub const fn is_type(&self) -> bool

Returns true if the enum is Cmd::Type otherwise false

Source

pub const fn is_exec(&self) -> bool

Returns true if the enum is Cmd::Exec otherwise false

Source

pub const fn is_pwd(&self) -> bool

Returns true if the enum is Cmd::Pwd otherwise false

Source

pub const fn is_history(&self) -> bool

Returns true if the enum is Cmd::History otherwise false

Source

pub const fn is_unknown(&self) -> bool

Returns true if the enum is Cmd::Unknown otherwise false

Source§

impl Cmd

Source

pub fn try_as_exit(self) -> Option<u8>

Source

pub const fn try_as_exit_ref(&self) -> Option<&u8>

Source

pub fn try_as_exit_mut(&mut self) -> Option<&mut u8>

Source§

impl Cmd

Source

pub fn from_input(raw: &str) -> Result<Option<Self>>

Source

pub fn from_parts( cmd_name: &str, args: Vec<String>, stdout: StdoutTarget, stderr: StderrTarget, ) -> Self

Source

pub fn run_with_status( &self, shell_name: &str, history: &[String], ) -> Result<(RunResult, u8)>

Run the command and return (RunResult, exit_status). Exit status is used for && / ||.

Source

pub fn run(&self, shell_name: &str, history: &[String]) -> Result<RunResult>

Trait Implementations§

Source§

impl Debug for Cmd

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Cmd

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Cmd

Source§

fn eq(&self, other: &Cmd) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Cmd

Auto Trait Implementations§

§

impl Freeze for Cmd

§

impl RefUnwindSafe for Cmd

§

impl Send for Cmd

§

impl Sync for Cmd

§

impl Unpin for Cmd

§

impl UnsafeUnpin for Cmd

§

impl UnwindSafe for Cmd

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, 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> 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.