pub struct Program(/* private fields */);Expand description
a program, pre-checked and known to exist in the environment $PATH
Implementations§
Source§impl Program
impl Program
Sourcepub fn new<P: AsRef<str>>(program: P) -> Result<Self>
pub fn new<P: AsRef<str>>(program: P) -> Result<Self>
create a new Program from the given string.
This function will check the program actually exists before returning the newly constructed program.
This will allow to pre-check all the necessary objects before utilising the program to the different commands.
§Error
the function will fail if the program cannot be found or cannot
be executed. The following program will return an error of kind
ErrorKind::InvalidProgramName:
let error = Program::new("unknown-program").unwrap_err();
match error.kind() {
ErrorKind::InvalidProgramName(_) => (),
// ...
}Trait Implementations§
Source§impl Ord for Program
impl Ord for Program
Source§impl PartialOrd for Program
impl PartialOrd for Program
impl Eq for Program
impl StructuralPartialEq for Program
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnwindSafe for Program
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