Skip to content

Commit

Permalink
docs(cargo): Provide pointers on how to cache
Browse files Browse the repository at this point in the history
This helps with assert-rs#6.
  • Loading branch information
epage committed Jul 27, 2018
1 parent 79435b5 commit cc7ad5f
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/cargo.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
//! Simplify running `bin`s in a Cargo project.
//!
//! # Examples
//! `CommandCargoExt` is an extension trait for `std::process::Command` to easily launch a crate's
//! binaries.
//!
//! In addition, the underlying functions for looking up the crate's binaries are exposed to allow
//! for optimizations, if needed.
//!
//! # Simple Example
//!
//! ```rust
//! use assert_cmd::prelude::*;
Expand All @@ -11,6 +17,22 @@
//! .unwrap()
//! .unwrap();
//! ```
//!
//! # Caching Example
//!
//! ```rust
//! use assert_cmd::prelude::*;
//!
//! use std::process::Command;
//!
//! let bin_under_test = assert_cmd::cargo::main_binary_path().unwrap();
//! Command::new(&bin_under_test)
//! .unwrap();
//! ```
//!
//! Tip: Use [`lazy_static][lazy_static] to cache `bin_under_test` across test functions.
//!
//! [lazy_static]: https://crates.io/crates/lazy_static
use std::error::Error;
use std::ffi;
Expand Down

0 comments on commit cc7ad5f

Please sign in to comment.