Struct bintest::BinTest

source ·
pub struct BinTest { /* private fields */ }
Expand description

Access to binaries build by cargo build. Starting with version 2.0.0 this is a singleton that is constructed by the first call to BinTest::new() or BinTest::with().build(). All calls to BinTest must be configured with the same configuration values, otherwise a panic will occur. This is made in anticipation of future versions which will allow building binary artifacts with different configurations while not panicking then.

Implementations§

source§

impl BinTest

source

pub fn new() -> &'static Self

Constructs a BinTest with the default configuration if not already constructed. Construction runs ‘cargo build’ and register all build executables. Executables are identified by their name, without path and filename extension.

§Returns

A reference to a immutable BinTest singleton that can be used to access the executables.

§Panics

All tests must run with the same configuration, when using only BinTest::new() this is infallible. Mixing this with differing configs from BinTest::with() will panic.

§Example
use bintest::BinTest;

let executables = BinTest::new();
source

pub const fn with() -> BinTestBuilder

Creates a BinTestBuilder for further customization.

§Example
use bintest::BinTest;

let executables = BinTest::with().quiet().build();
source

pub fn list_executables(&self) -> Iter<'_, String, Utf8PathBuf>

Gives an (name, path) iterator over all executables found.

§Example
use bintest::BinTest;

let executables = BinTest::new();

for (name, path) in executables.list_executables() {
    println!("{} @ {}", name, path);
}
source

pub fn command(&self, name: &str) -> Command

Constructs a std::process::Command for the given executable name

Trait Implementations§

source§

impl Debug for BinTest

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.