Struct test_casing::Product

source ·
pub struct Product<Ts>(pub Ts);
Expand description

Cartesian product of several test cases.

For now, this supports products of 2..8 values. The provided IntoIterator expression for each value must implement Clone. One way to do that is using TestCases, which wraps a lazy iterator initializer and is thus always Copyable.

§Examples

let product = Product((0..2, ["test", "other"]));
let values: Vec<_> = product.into_iter().collect();
assert_eq!(
    values,
    [(0, "test"), (0, "other"), (1, "test"), (1, "other")]
);

Tuple Fields§

§0: Ts

Trait Implementations§

source§

impl<Ts: Clone> Clone for Product<Ts>

source§

fn clone(&self) -> Product<Ts>

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<Ts: Debug> Debug for Product<Ts>

source§

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

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

impl<T, U> IntoIterator for Product<(T, U)>

§

type Item = (<T as IntoIterator>::Item, <U as IntoIterator>::Item)

The type of the elements being iterated over.
§

type IntoIter = ProductIter<T, U>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T, U, V> IntoIterator for Product<(T, U, V)>
where T: 'static + Clone + IntoIterator, U: 'static + Clone + IntoIterator, V: 'static + Clone + IntoIterator,

§

type Item = (<T as IntoIterator>::Item, <U as IntoIterator>::Item, <V as IntoIterator>::Item)

The type of the elements being iterated over.
§

type IntoIter = Box<dyn Iterator<Item = <Product<(T, U, V)> as IntoIterator>::Item>>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T, U, V, W> IntoIterator for Product<(T, U, V, W)>
where T: 'static + Clone + IntoIterator, U: 'static + Clone + IntoIterator, V: 'static + Clone + IntoIterator, W: 'static + Clone + IntoIterator,

§

type Item = (<T as IntoIterator>::Item, <U as IntoIterator>::Item, <V as IntoIterator>::Item, <W as IntoIterator>::Item)

The type of the elements being iterated over.
§

type IntoIter = Box<dyn Iterator<Item = <Product<(T, U, V, W)> as IntoIterator>::Item>>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T, U, V, W, X> IntoIterator for Product<(T, U, V, W, X)>
where T: 'static + Clone + IntoIterator, U: 'static + Clone + IntoIterator, V: 'static + Clone + IntoIterator, W: 'static + Clone + IntoIterator, X: 'static + Clone + IntoIterator,

§

type Item = (<T as IntoIterator>::Item, <U as IntoIterator>::Item, <V as IntoIterator>::Item, <W as IntoIterator>::Item, <X as IntoIterator>::Item)

The type of the elements being iterated over.
§

type IntoIter = Box<dyn Iterator<Item = <Product<(T, U, V, W, X)> as IntoIterator>::Item>>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T, U, V, W, X, Y> IntoIterator for Product<(T, U, V, W, X, Y)>
where T: 'static + Clone + IntoIterator, U: 'static + Clone + IntoIterator, V: 'static + Clone + IntoIterator, W: 'static + Clone + IntoIterator, X: 'static + Clone + IntoIterator, Y: 'static + Clone + IntoIterator,

§

type Item = (<T as IntoIterator>::Item, <U as IntoIterator>::Item, <V as IntoIterator>::Item, <W as IntoIterator>::Item, <X as IntoIterator>::Item, <Y as IntoIterator>::Item)

The type of the elements being iterated over.
§

type IntoIter = Box<dyn Iterator<Item = <Product<(T, U, V, W, X, Y)> as IntoIterator>::Item>>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T, U, V, W, X, Y, Z> IntoIterator for Product<(T, U, V, W, X, Y, Z)>
where T: 'static + Clone + IntoIterator, U: 'static + Clone + IntoIterator, V: 'static + Clone + IntoIterator, W: 'static + Clone + IntoIterator, X: 'static + Clone + IntoIterator, Y: 'static + Clone + IntoIterator, Z: 'static + Clone + IntoIterator,

§

type Item = (<T as IntoIterator>::Item, <U as IntoIterator>::Item, <V as IntoIterator>::Item, <W as IntoIterator>::Item, <X as IntoIterator>::Item, <Y as IntoIterator>::Item, <Z as IntoIterator>::Item)

The type of the elements being iterated over.
§

type IntoIter = Box<dyn Iterator<Item = <Product<(T, U, V, W, X, Y, Z)> as IntoIterator>::Item>>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<Ts: Copy> Copy for Product<Ts>

Auto Trait Implementations§

§

impl<Ts> RefUnwindSafe for Product<Ts>
where Ts: RefUnwindSafe,

§

impl<Ts> Send for Product<Ts>
where Ts: Send,

§

impl<Ts> Sync for Product<Ts>
where Ts: Sync,

§

impl<Ts> Unpin for Product<Ts>
where Ts: Unpin,

§

impl<Ts> UnwindSafe for Product<Ts>
where Ts: UnwindSafe,

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.