pub struct SubsetsFromPersianRug<T> { /* private fields */ }
Available on crate feature persian-rug only.
Expand description

Produce subsets of the existing Proxy<T> items in the context.

The yield pattern is the same as the regular Subsets generator. It is safe to add more items, and they will occur in their natural place in future items yielded by the generator.

Example:

use boulder::{GeneratorWithPersianRug, SubsetsFromPersianRug};
use persian_rug::{contextual, persian_rug, Context, Proxy};

#[contextual(Rug)]
struct Foo {
  a: i32
}

#[persian_rug]
struct Rug(#[table] Foo);

let mut r = Rug(Default::default());
let f1 = r.add(Foo { a: 0 });
let f2 = r.add(Foo { a: 1 });

let mut g = SubsetsFromPersianRug::<Foo>::new();
let (s1, _) = g.generate(&mut r);
assert_eq!(s1, Vec::new());
let (s2, _) = g.generate(&mut r);
assert_eq!(s2, vec![ f1 ]);
let (s3, _) = g.generate(&mut r);
assert_eq!(s3, vec![ f2 ]);
let (s4, _) = g.generate(&mut r);
assert_eq!(s4, vec![ f1, f2 ]);

Implementations

Trait Implementations

Returns the “default value” for a type. 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 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.