etui/widgets/paginator
Types
pub type Paginator {
Paginator(
current: Int,
total: Int,
page_size: Int,
style: PaginatorStyle,
active_char: String,
inactive_char: String,
fg: style.Color,
bg: style.Color,
)
}
Constructors
-
Paginator( current: Int, total: Int, page_size: Int, style: PaginatorStyle, active_char: String, inactive_char: String, fg: style.Color, bg: style.Color, )
pub type PaginatorStyle {
Dots
Arabic
}
Constructors
-
Dots -
Arabic
Values
pub fn go_to(p: Paginator, page: Int) -> Paginator
Jump to a specific page, clamped to [0, total - 1].
pub fn paginator_new(total: Int) -> Paginator
New paginator. total is clamped to at least 1. Starts on page 0.
pub fn render(
buf: buffer.Buffer,
area: geometry.Rect,
p: Paginator,
) -> buffer.Buffer
pub fn set_item_count(p: Paginator, items: Int) -> Paginator
Recompute total from an item count and the current page_size.
Clamps current so it stays in range.
pub fn slice(items: List(a), p: Paginator) -> List(a)
Pull the items belonging to the current page.
pub fn with_colors(
p: Paginator,
fg: style.Color,
bg: style.Color,
) -> Paginator
pub fn with_page_size(p: Paginator, n: Int) -> Paginator
Items per page (used by slice/2). Default 10.
pub fn with_style(p: Paginator, st: PaginatorStyle) -> Paginator