pub struct CommandSpec { /* private fields */ }Expand description
An executable and its argv arguments.
The program and arguments use OsString so a local harness can preserve
platform-native command-line values. This type does not interpret shell
syntax; callers that need a shell must put the shell executable and its
arguments in the vector explicitly.
Implementations§
Source§impl CommandSpec
impl CommandSpec
Sourcepub fn new(program: impl Into<OsString>) -> Result<Self, CommandError>
pub fn new(program: impl Into<OsString>) -> Result<Self, CommandError>
Creates a command with no arguments.
Sourcepub fn with_arg(
self,
argument: impl Into<OsString>,
) -> Result<Self, CommandError>
pub fn with_arg( self, argument: impl Into<OsString>, ) -> Result<Self, CommandError>
Adds one argv argument and returns the updated command.
Sourcepub fn with_args<I, S>(self, arguments: I) -> Result<Self, CommandError>
pub fn with_args<I, S>(self, arguments: I) -> Result<Self, CommandError>
Adds several argv arguments and returns the updated command.
Sourcepub fn into_parts(self) -> (OsString, Vec<OsString>)
pub fn into_parts(self) -> (OsString, Vec<OsString>)
Returns the executable and arguments as owned values.
Trait Implementations§
Source§impl Clone for CommandSpec
impl Clone for CommandSpec
Source§impl Debug for CommandSpec
impl Debug for CommandSpec
impl Eq for CommandSpec
Source§impl PartialEq for CommandSpec
impl PartialEq for CommandSpec
impl StructuralPartialEq for CommandSpec
Auto Trait Implementations§
impl Freeze for CommandSpec
impl RefUnwindSafe for CommandSpec
impl Send for CommandSpec
impl Sync for CommandSpec
impl Unpin for CommandSpec
impl UnsafeUnpin for CommandSpec
impl UnwindSafe for CommandSpec
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