Struct BasicCmd

Source
pub struct BasicCmd { /* private fields */ }
Expand description

A basic command is a parsed form of for example

  • cat < in.txt, or
  • tee file.txt, or
  • wc -l > out.txt inside cat < in.txt | tee file.txt | wc -l > out.txt &.

Implementations§

Source§

impl BasicCmd

Source

pub fn executable(&self) -> &str

Getter for executable.

Source

pub fn args(&self) -> &Vec<String>

Getter for args.

Source

pub fn in_red_path(&self) -> &Option<String>

Getter for in_red_path.

Source

pub fn out_red_path(&self) -> &Option<String>

Getter for in_red_path.

Source

pub fn is_first(&self) -> bool

Getter for is_first.

Source

pub fn is_last(&self) -> bool

Getter for is_last.

Source

pub fn is_in_middle(&self) -> bool

Getter for is_in_middle.

Source

pub fn args_to_c_argv(&self) -> *const *const c_char

Constructs the null-terminated argv-array on the heap. Memory must be freed theoretically in order to have proper memory management but because the address space content is replaced after “exec()” you don’t have to free it in case of successful exec().

Source

pub fn executable_cstring(&self) -> CString

Constructs a CString for executable.

Source

pub fn out_red_path_cstring(&self) -> Option<CString>

Constructs a CString for out_red_path.

Source

pub fn in_red_path_cstring(&self) -> Option<CString>

Constructs a CString for in_red_path.

Trait Implementations§

Source§

impl Builder<BasicCmd> for BasicCmdBuilder

Source§

fn build(self) -> BasicCmd

Builds a BasicCmd-object, if self is valid.

Source§

impl Debug for BasicCmd

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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