pub struct Paging {
pub window: Window,
pub paged: bool,
}Expand description
Where a reader is in a set that arrived in parts.
A Window wearing the paged reading of itself. Distinct from a carousel’s
window at the top level on purpose, because the intent differs and a call
site should say which one it means, while the arithmetic below is shared so
the two cannot drift apart.
§The two idioms, and which one a renderer may draw
Load-more and numbered pages are both this type. Which is honest is
paged: a set whose page size is known can be drawn as
“Page 3 of 8”, and one without can only be drawn as “150 of 400” and a way
forward. Saying it here rather than letting each renderer guess is the point
— three renderers inferring it from the numbers is how they come to disagree.
§What it does not carry
No addresses. makeover-layout cannot name an action, and the way to ask for
the next part is the host’s: quasi_router pairs this with the addresses the
same way Row pairs its parts with Row::activate. That split is the reason
this type is reusable by a carousel, which has nothing to ask.
Fields§
§window: WindowThe window onto the set.
paged: boolWhether the parts are a fixed size, and so whether pages are countable.
false for load-more, where the window simply grew and “page 2” would
name nothing.
Implementations§
Source§impl Paging
impl Paging
Sourcepub const fn more(shown: usize) -> Self
pub const fn more(shown: usize) -> Self
The first shown, with more behind them.
The load-more shape: the window starts at the beginning and grows, so there is no page to number.
Sourcepub const fn of(self, of: usize) -> Self
pub const fn of(self, of: usize) -> Self
How many there are altogether.
Left unsaid by a host that cannot count, and left unsaid for good: a total arriving later widens whatever prints it. See “First paint is final paint” in the crate header.
Sourcepub const fn page(self) -> Option<usize>
pub const fn page(self) -> Option<usize>
Which page this is, counting from one, when pages are countable.
One-based because it is read aloud. Window::index is the zero-based
form for anyone indexing with it.
Sourcepub const fn pages_total(self) -> Option<usize>
pub const fn pages_total(self) -> Option<usize>
How many pages there are, when that is countable.
Sourcepub const fn remaining(self) -> Option<usize>
pub const fn remaining(self) -> Option<usize>
How many are not shown yet, when the host counted.
The figure a load-more control puts in its label. None is the honest
and common case: a set that cannot say how many more there are still has
a way to ask for them.
Sourcepub const fn has_previous(self) -> bool
pub const fn has_previous(self) -> bool
Whether there is anything back the other way.