pub trait OutputOkExtwhere
    Self: Sized,{
    // Required method
    fn ok(self) -> OutputResult;

    // Provided methods
    fn unwrap(self) -> Output { ... }
    fn unwrap_err(self) -> OutputError { ... }
}
Expand description

Converts a type to an OutputResult.

This is for example implemented on std::process::Output.

Examples

use assert_cmd::prelude::*;

use std::process::Command;

let result = Command::new("echo")
    .args(&["42"])
    .ok();
assert!(result.is_ok());

Required Methods§

source

fn ok(self) -> OutputResult

Convert an Output to an OutputResult.

Examples
use assert_cmd::prelude::*;

use std::process::Command;

let result = Command::new("echo")
    .args(&["42"])
    .ok();
assert!(result.is_ok());

Provided Methods§

source

fn unwrap(self) -> Output

Unwrap a Output but with a prettier message than .ok().unwrap().

Examples
use assert_cmd::prelude::*;

use std::process::Command;

let output = Command::new("echo")
    .args(&["42"])
    .unwrap();
source

fn unwrap_err(self) -> OutputError

Unwrap a Output but with a prettier message than ok().err().unwrap().

Examples
use assert_cmd::prelude::*;

use std::process::Command;

let err = Command::new("a-command")
    .args(&["--will-fail"])
    .unwrap_err();

Implementations on Foreign Types§

source§

impl OutputOkExt for Output

source§

impl<'c> OutputOkExt for &'c mut Command

Implementors§

source§

impl<'c> OutputOkExt for &'c mut assert_cmd::cmd::Command