pub struct Partitions { /* private fields */ }
Expand description
Iterates over the partitions of a given positive integer.
Implementations§
Source§impl Partitions
impl Partitions
Sourcepub fn new(n: usize) -> Partitions
pub fn new(n: usize) -> Partitions
Makes a new iterator.
Sourcepub fn next(&mut self) -> Option<&[usize]>
pub fn next(&mut self) -> Option<&[usize]>
Advances the iterator and returns the next partition.
Sourcepub fn recycle(n: usize, vec: Vec<usize>) -> Partitions
pub fn recycle(n: usize, vec: Vec<usize>) -> Partitions
Makes a new iterator, trying to avoid allocations.
Any vector can be passed to this function, since its contents
will be cleared and it will be filled with zeroes, but note
that the vector will still reallocate if its capacity is less
than n + 1
.
Auto Trait Implementations§
impl Freeze for Partitions
impl RefUnwindSafe for Partitions
impl Send for Partitions
impl Sync for Partitions
impl Unpin for Partitions
impl UnwindSafe for Partitions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more