# `into-result` [![crates.io badge](http://meritbadge.herokuapp.com/as_tuple)](https://crates.io/crates/into-result) [![docs.rs badge](https://docs.rs/as_tuple/badge.svg)](https://docs.rs/into-result) [![Travis badge](https://travis-ci.org/francesca64/as_tuple.svg?branch=mistress)](https://travis-ci.org/francesca64/into-result) A simple convenience trait for converting something into a `Result` or `Option`. Out of the box, this gives you improved error handling for [`Command::output`](https://doc.rust-lang.org/std/process/struct.Command.html#method.output) [`Command::spawn`](https://doc.rust-lang.org/std/process/struct.Command.html#method.spawn), and [`Command::status`](https://doc.rust-lang.org/std/process/struct.Command.html#method.status). These methods only return `Err` if the process fails to *spawn*; further handling is required to check if the command has a successful exit status. `IntoResult` does that handling for you, folding both types of failure into one `Result`: ```rust use into_result::{IntoResult as _}; use std::process::Command; Command::new("ls") .spawn() .into_result() .expect("either failed to spawn command, or command returned non-zero exit status"); ``` You can run [the example](examples/command.rs) to see what this looks like in practice. `into-result` also has `no_std` support via `no-default-features`. You'll still get the `IntoResult` trait and an impl for `bool`.