ShellPrintable

Trait ShellPrintable 

Source
pub trait ShellPrintable {
    // Required methods
    fn printable_invocation_string(&self) -> Result<String, Utf8Error>;
    fn printable_invocation_string_lossy(&self) -> String;

    // Provided methods
    fn print_invocation(&mut self) -> Result<&mut Self, Utf8Error> { ... }
    fn print_invocation_lossy(&mut self) -> &mut Self { ... }
}

Required Methods§

Provided Methods§

Source

fn print_invocation(&mut self) -> Result<&mut Self, Utf8Error>

Examples found in repository?
examples/echo.rs (line 6)
5fn main() {
6    let _ = Command::new("echo").args(["#hi"]).print_invocation();
7}
More examples
Hide additional examples
examples/cargo-version.rs (line 6)
3fn main() {
4    assert!(PrintableShellCommand::new("cargo")
5        .arg("--version")
6        .print_invocation()
7        .unwrap()
8        .status()
9        .unwrap()
10        .success());
11}
examples/ffmpeg.rs (line 9)
3fn main() {
4    let _ = PrintableShellCommand::new("ffmpeg")
5        .args(["-i", "./test/My video.mp4"])
6        .args(["-filter:v", "setpts=2.0*PTS"])
7        .args(["-filter:a", "atempo=0.5"])
8        .arg("./test/My video (slow-mo).mov")
9        .print_invocation()
10        .unwrap();
11}
Source

fn print_invocation_lossy(&mut self) -> &mut Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ShellPrintable for Command

Implementors§