pub struct TableState<T> {
pub items: Vec<T>,
pub selected: usize,
pub loading: bool,
pub filter: String,
pub page_size: PageSize,
pub expanded_item: Option<usize>,
pub scroll_offset: usize,
pub next_token: Option<String>,
}Expand description
Generic table state for list-based services
Fields§
§items: Vec<T>§selected: usize§loading: bool§filter: String§page_size: PageSize§expanded_item: Option<usize>§scroll_offset: usize§next_token: Option<String>Implementations§
Source§impl<T> TableState<T>
impl<T> TableState<T>
pub fn new() -> Self
pub fn filtered<F>(&self, predicate: F) -> Vec<&T>
pub fn paginate<'a>(&self, filtered: &'a [&'a T]) -> &'a [&'a T]
pub fn current_page(&self, _total_items: usize) -> usize
pub fn total_pages(&self, total_items: usize) -> usize
pub fn next_item(&mut self, max: usize)
pub fn prev_item(&mut self)
pub fn page_down(&mut self, max: usize)
pub fn page_up(&mut self)
pub fn snap_to_page(&mut self)
pub fn toggle_expand(&mut self)
pub fn collapse(&mut self)
pub fn expand(&mut self)
pub fn is_expanded(&self) -> bool
pub fn has_expanded_item(&self) -> bool
pub fn goto_page(&mut self, page: usize, total_items: usize)
pub fn reset(&mut self)
pub fn get_selected<'a>(&self, filtered: &'a [&'a T]) -> Option<&'a T>
Sourcepub fn filter_push(&mut self, c: char)
pub fn filter_push(&mut self, c: char)
Push a character to the filter and reset selection
Sourcepub fn filter_pop(&mut self)
pub fn filter_pop(&mut self)
Pop a character from the filter and reset selection
Sourcepub fn filter_clear(&mut self)
pub fn filter_clear(&mut self)
Clear the filter and reset selection
Trait Implementations§
Source§impl<T: Clone> Clone for TableState<T>
impl<T: Clone> Clone for TableState<T>
Source§fn clone(&self) -> TableState<T>
fn clone(&self) -> TableState<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for TableState<T>
impl<T: Debug> Debug for TableState<T>
Auto Trait Implementations§
impl<T> Freeze for TableState<T>
impl<T> RefUnwindSafe for TableState<T>where
T: RefUnwindSafe,
impl<T> Send for TableState<T>where
T: Send,
impl<T> Sync for TableState<T>where
T: Sync,
impl<T> Unpin for TableState<T>where
T: Unpin,
impl<T> UnsafeUnpin for TableState<T>
impl<T> UnwindSafe for TableState<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.