Skip to main content

TestFilter

Trait TestFilter 

Source
pub trait TestFilter<Extra> {
    // Required method
    fn filter<'t>(
        &self,
        tests: &'t [Test<Extra>],
    ) -> FilteredTests<'t, impl ExactSizeIterator<Item = &'t Test<Extra>>, Extra>;
}
Expand description

A strategy for selecting which tests are included in a test run.

A TestFilter is applied before any ignore logic or test execution. Tests that are filtered out are completely removed from the run and are never seen by later stages.

This trait is used by the test harness to reduce the set of tests it needs to work on.

Required Methods§

Source

fn filter<'t>( &self, tests: &'t [Test<Extra>], ) -> FilteredTests<'t, impl ExactSizeIterator<Item = &'t Test<Extra>>, Extra>

Filter the given slice of tests.

The returned FilteredTests contains an iterator over the tests that are included in the run, as well as the number of tests that were filtered out.

The iterator must yield references into the original tests slice and must have an exact size.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Extra> TestFilter<Extra> for DefaultFilter

Source§

impl<Extra: Sync> TestFilter<Extra> for NoFilter