Trait cradle::CmdArgument [−][src]
pub trait CmdArgument { }
Expand description
All types that are possible arguments to cmd!
have to implement this trait.
Implementations on Foreign Types
Blanket implementation for &_
.
Arguments of type &str
are passed to the child process
as arguments.
Arguments of type String
are passed to the child process
as arguments.
Allows to use split
to split your argument into words:
use cradle::*; let StdoutTrimmed(output) = cmd!("echo foo".split(' ')); assert_eq!(output, "foo");
Allows to use split_whitespace
to split your argument into words:
use cradle::*; let StdoutTrimmed(output) = cmd!("echo foo".split_whitespace()); assert_eq!(output, "foo");
Allows to use split_ascii_whitespace
to split your argument into words:
use cradle::*; let StdoutTrimmed(output) = cmd!("echo foo".split_ascii_whitespace()); assert_eq!(output, "foo");
All elements of the given Vec
are used as arguments to cmd!
.
Same as passing in the elements separately.
use cradle::*; let StdoutTrimmed(output) = cmd!(vec!["echo", "foo"]); assert_eq!(output, "foo");
Similar to the implementation for Vec<T>
.
All elements of the array will be used as arguments.
use cradle::*; let StdoutTrimmed(output) = cmd!(["echo", "foo"]); assert_eq!(output, "foo");
Only works on rust version 1.51
and up.
Similar to the implementation for Vec<T>
.
All elements of the slice will be used as arguments.
Arguments of type PathBuf
are passed to the child process
as arguments.
use cradle::*; use std::path::PathBuf; let current_dir: PathBuf = std::env::current_dir().unwrap(); cmd_unit!("ls", current_dir);
Arguments of type &Path
are passed to the child process
as arguments.
use cradle::*; use std::path::Path; let file: &Path = Path::new("./foo"); cmd_unit!("touch", file);