paginated_list

Function paginated_list 

Source
pub fn paginated_list<T: Display>(
    header_message: Option<&str>,
    items: &[T],
    items_per_page: i32,
    clear_on_update: bool,
)
Expand description

Displays a paginated list of items.

§Arguments

  • header_message - An option that can contain a string slice which holds a header message for the paginated list.
  • items - An array of items of a type with ‘Display’ trait
  • items_per_page - The number of items that will be displayed per page.
  • clear_on_update - A boolean which denotes whether the terminal should clear each time the user navigates to a new page. This is helpful when making command-line apps that “re-render” a single display.

§Examples

use simple_cli::*;
let items = vec!["Moe", "Larry", "Curly"];
paginated_list(Some("Here is my paginated list:"), &items, 2, true);

use simple_cli::*;
let items = vec![1, 2, 3, 4, 5, 6, 7, 8, 9];
paginated_list::<i8>(Some("Here is my paginated list:"), &items, 2, true);