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
impl BinTestBuilder
sourcepub const fn release(self) -> Self
pub const fn release(self) -> Self
Build in release mode, this is the default for release builds.
sourcepub const fn all_targets(self) -> Self
pub const fn all_targets(self) -> Self
Build all targets (–lib –bins –tests –benches –examples).
sourcepub const fn features(self, features: &'static str) -> Self
pub const fn features(self, features: &'static str) -> Self
Configure ‘–features’ list of features to build.
sourcepub const fn binary(self, binary: &'static str) -> Self
pub const fn binary(self, binary: &'static str) -> Self
Allow only building a specific binary in the case of multiple in a workspace/package.
sourcepub const fn binaries(self, binaries: &'static [&'static str]) -> Self
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.
sourcepub const fn example(self, example: &'static str) -> Self
pub const fn example(self, example: &'static str) -> Self
Allow only building a specific example in the case of multiple in a workspace/package.
sourcepub const fn examples(self, examples: &'static [&'static str]) -> Self
pub const fn examples(self, examples: &'static [&'static str]) -> Self
Allow only building specific examples in the case of multiple in a workspace/package.
sourcepub fn build(self) -> &'static BinTest
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
impl Clone for BinTestBuilder
source§fn clone(&self) -> BinTestBuilder
fn clone(&self) -> BinTestBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BinTestBuilder
impl Debug for BinTestBuilder
source§impl PartialEq for BinTestBuilder
impl PartialEq for BinTestBuilder
source§fn eq(&self, other: &BinTestBuilder) -> bool
fn eq(&self, other: &BinTestBuilder) -> bool
self
and other
values to be equal, and is used
by ==
.