pub struct Subsets<T: Clone> { /* private fields */ }
Expand description
Subsets of a base collection.
The pattern for the yielded values is:
vec![]
vec![a]
vec![b]
vec![a,b]
vec![c]
vec![a,c]
vec![b,c]
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
Trait Implementations
sourceimpl<C, T> GeneratorWithPersianRug<C> for Subsets<T> where
T: Clone + 'static,
C: Context,
impl<C, T> GeneratorWithPersianRug<C> for Subsets<T> where
T: Clone + 'static,
C: Context,
Auto Trait Implementations
impl<T> RefUnwindSafe for Subsets<T> where
T: RefUnwindSafe,
impl<T> Send for Subsets<T> where
T: Send,
impl<T> Sync for Subsets<T> where
T: Sync,
impl<T> Unpin for Subsets<T> where
T: Unpin,
impl<T> UnwindSafe for Subsets<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more