gleamtea/paginator

A bubble: a paginator (dots or “N/M”).

Types

An opaque paginator value.

pub type Paginator

Values

pub fn new(
  total_items total_items: Int,
  per_page per_page: Int,
) -> Paginator

A paginator over total_items items, showing per_page per page.

pub fn page(paginator: Paginator) -> Int

The current page (0-based).

pub fn slice_bounds(
  paginator: Paginator,
  total: Int,
) -> #(Int, Int)

The #(start, end) indices (0-based, half-open) for the current page over a collection of total items.

pub fn total_pages(paginator: Paginator) -> Int

The total number of pages.

pub fn update(
  msg: msg,
  paginator: Paginator,
) -> #(Paginator, gleamtea.Cmd(msg))

Move between pages with ←/→, h/l, or PageUp/PageDown.

pub fn view(paginator: Paginator) -> String

Render the paginator.

Search Document