pub struct Command { /* private fields */ }
Expand description
There’s a lot of common manipulation of what we think of as a command. This type factors out some of that, specifically:
- conversion from an arbitrary sequence of strings
- conversion to async_process’s builder type
- debugging representation
Implementations§
Source§impl Command
impl Command
Sourcepub fn new<T: Into<OsString>>(command: T) -> Self
pub fn new<T: Into<OsString>>(command: T) -> Self
Constructs a new Command
from a program or command name.
Sourcepub fn with_args<T>(self, args: T) -> Self
pub fn with_args<T>(self, args: T) -> Self
Adds a sequence of arguments to the command. The trait bound for T
is:
T where
T: IntoIterator,
T::Item: Into<OsString>
…and can be understood as:
T
is anything that can turn into an iterator- the iterator items are anything that can turn into an
OsString
Commonly this might be a Vec<String>
or just [&str]
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
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