Struct bintest::BinTestBuilder

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

Allows configuration of a workspace to find an executable in.

This builder is completely const constructible.

Implementations§

source§

impl BinTestBuilder

source

pub const fn workspace(self) -> Self

Build all executables in all workspaces.

source

pub const fn quiet(self) -> Self

Disables extra output from the cargo build run.

source

pub const fn release(self) -> Self

Build in release mode, this is the default for release builds.

source

pub const fn debug(self) -> Self

Build in debug mode, this is the default for debug builds.

source

pub const fn offline(self) -> Self

Build in offline mode.

source

pub const fn all_targets(self) -> Self

Build all targets (–lib –bins –tests –benches –examples).

source

pub const fn features(self, features: &'static str) -> Self

Configure ‘–features’ list of features to build.

source

pub const fn profile(self, profile: &'static str) -> Self

Select a ‘–profile’ for building.

source

pub const fn binary(self, binary: &'static str) -> Self

Allow only building a specific binary in the case of multiple in a workspace/package.

source

pub const fn binaries(self, binaries: &'static [&'static str]) -> Self

Allow only building specific binaríes in the case of multiple in a workspace/package.

source

pub const fn example(self, example: &'static str) -> Self

Allow only building a specific example in the case of multiple in a workspace/package.

source

pub const fn examples(self, examples: &'static [&'static str]) -> Self

Allow only building specific examples in the case of multiple in a workspace/package.

source

pub fn build(self) -> &'static BinTest

Constructs a BinTest with from this builder 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, this can be either achieved by calling BinTest::with() always with the same configuration or by providing a function that constructs and returns the BinTest singleton:

use bintest::{BinTest, BinTestBuilder};

// #[cfg(test)]
fn my_bintest() -> &'static BinTest {
    // The Builder can be all const constructed
    static BINTEST_CONFIG: BinTestBuilder = BinTest::with().quiet();
    BINTEST_CONFIG.build()
}

// #[test]
fn example() {
    let bintest = my_bintest();
}

Trait Implementations§

source§

impl Clone for BinTestBuilder

source§

fn clone(&self) -> BinTestBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BinTestBuilder

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq for BinTestBuilder

source§

fn eq(&self, other: &BinTestBuilder) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for BinTestBuilder

source§

impl StructuralPartialEq for BinTestBuilder

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.