referrerpolicy=no-referrer-when-downgrade

Pagify

pub trait Pagify<T> {
    // Required method
    fn pagify(
        &self,
        bound: PageIndex,
    ) -> Box<dyn Iterator<Item = (PageIndex, &T)> + '_>;
}
Expand description

A helper trait to deal with the page index of partial solutions.

This should only be called on the Vec<Solution> or similar types. If the solution is full, then it returns a normal iterator that is just mapping the index (usize) to PageIndex.

if the solution is partial, it shifts the indices sufficiently so that the most significant page of the solution matches with the most significant page of the snapshot onchain.

See the tests below for examples.

Required Methods§

Source

fn pagify( &self, bound: PageIndex, ) -> Box<dyn Iterator<Item = (PageIndex, &T)> + '_>

Pagify a reference.

Implementations on Foreign Types§

Source§

impl<T> Pagify<T> for Vec<T>

Source§

fn pagify( &self, desired_pages: PageIndex, ) -> Box<dyn Iterator<Item = (PageIndex, &T)> + '_>

Implementors§