Trait assert_cmd::cargo::CommandCargoExt[][src]

pub trait CommandCargoExt where
    Self: Sized
{ fn cargo_bin<S: AsRef<str>>(name: S) -> Result<Self, CargoError>; }
Expand description

Create a Command for a bin in the Cargo project.

CommandCargoExt is an extension trait for [Command][Command] to easily launch a crate’s binaries.

See the [cargo module documentation][cargo] for caveats and workarounds.

Examples

use assert_cmd::prelude::*;

use std::process::Command;

let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME"))
    .unwrap();
let output = cmd.unwrap();
println!("{:?}", output);

Required methods

fn cargo_bin<S: AsRef<str>>(name: S) -> Result<Self, CargoError>[src]

Expand description

Create a Command to run a specific binary of the current crate.

See the [cargo module documentation][cargo] for caveats and workarounds.

Examples

use assert_cmd::prelude::*;

use std::process::Command;

let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME"))
    .unwrap();
let output = cmd.unwrap();
println!("{:?}", output);
use assert_cmd::prelude::*;

use std::process::Command;

let mut cmd = Command::cargo_bin("bin_fixture")
    .unwrap();
let output = cmd.unwrap();
println!("{:?}", output);
Loading content...

Implementations on Foreign Types

impl CommandCargoExt for Command[src]

fn cargo_bin<S: AsRef<str>>(name: S) -> Result<Self, CargoError>[src]

Loading content...

Implementors

impl CommandCargoExt for assert_cmd::cmd::Command[src]

fn cargo_bin<S: AsRef<str>>(name: S) -> Result<Self, CargoError>[src]

Loading content...