pub struct Subsets<T: Clone> { /* private fields */ }
Expand description

Subsets of a base collection.

The pattern for the yielded values is:

  1. vec![]
  2. vec![a]
  3. vec![b]
  4. vec![a,b]
  5. vec![c]
  6. vec![a,c]
  7. vec![b,c]
  8. vec![a,b,c]

where the a is the first element of the base collection, b is the second, and so on.

Example:

use boulder::{Generator, Subsets};

let mut g = Subsets::new(1..4);
assert_eq!(g.generate(), vec![]);
assert_eq!(g.generate(), vec![1]);
assert_eq!(g.generate(), vec![2]);
assert_eq!(g.generate(), vec![1,2]);

Implementations

Create a new generator.

base will be collected into a Vec for re-sampling.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

The output type.

Make a new object. Read more

Available on crate feature persian-rug only.

The output type.

Available on crate feature persian-rug only.

Make a new object. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.