pub struct State<Row, Key> { /* private fields */ }data-table only.Expand description
The rows, the columns and how the reader is looking at them.
Implementations§
Source§impl<Row, Key: Clone + Eq + Hash> State<Row, Key>
impl<Row, Key: Clone + Eq + Hash> State<Row, Key>
Sourcepub fn new(
columns: impl IntoIterator<Item = Column<Row>>,
rows: impl IntoIterator<Item = Row>,
key: fn(&Row) -> Key,
) -> Self
pub fn new( columns: impl IntoIterator<Item = Column<Row>>, rows: impl IntoIterator<Item = Row>, key: fn(&Row) -> Key, ) -> Self
A table over rows, showing columns in order. key gives each
row an identity that survives sorting and new rows, such as an id.
Sourcepub fn with_selection(self, selectable: bool) -> Self
pub fn with_selection(self, selectable: bool) -> Self
Adds a checkbox to every row and a select-all box to the header.
Sourcepub fn with_page_sizes(self, sizes: impl IntoIterator<Item = usize>) -> Self
pub fn with_page_sizes(self, sizes: impl IntoIterator<Item = usize>) -> Self
The sizes offered in the footer. The first is used to start with.
pub fn with_sort(self, column: ColumnId, direction: Direction) -> Self
Starts with these columns hidden.
pub fn rows(&self) -> &[Row]
pub fn columns(&self) -> &[Column<Row>]
Sourcepub fn visible_columns(&self) -> Vec<&Column<Row>>
pub fn visible_columns(&self) -> Vec<&Column<Row>>
The columns on screen, in order.
pub fn column(&self, id: ColumnId) -> Option<&Column<Row>>
The Columns menu, with a check for each hideable column.
pub fn key(&self, row: &Row) -> Key
pub fn row(&self, key: &Key) -> Option<&Row>
Sourcepub fn set_rows(&mut self, rows: impl IntoIterator<Item = Row>)
pub fn set_rows(&mut self, rows: impl IntoIterator<Item = Row>)
Replaces every row. The sort, filters and selection of rows that remain are kept.
pub fn push(&mut self, row: Row)
Sourcepub fn update_row(&mut self, key: &Key, change: impl FnOnce(&mut Row))
pub fn update_row(&mut self, key: &Key, change: impl FnOnce(&mut Row))
Changes the row with this key, if there is one.
Sourcepub fn retain(&mut self, keep: impl FnMut(&Row) -> bool)
pub fn retain(&mut self, keep: impl FnMut(&Row) -> bool)
Keeps only the rows for which keep returns true.
pub fn sort(&self) -> Option<(ColumnId, Direction)>
pub fn search(&self) -> &str
Sourcepub fn filter(&self, column: ColumnId) -> Option<&str>
pub fn filter(&self, column: ColumnId) -> Option<&str>
The text a column is filtered to, if any.
Sourcepub fn is_filtered(&self) -> bool
pub fn is_filtered(&self) -> bool
Whether the search or any filter hides rows.
Sourcepub fn options(&self, column: ColumnId) -> &[String]
pub fn options(&self, column: ColumnId) -> &[String]
The distinct texts of a filterable column, to choose from.
Sourcepub fn filtered_len(&self) -> usize
pub fn filtered_len(&self) -> usize
How many rows pass the search and filters.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn page_size(&self) -> usize
pub fn page_sizes(&self) -> &[usize]
Sourcepub fn page_count(&self) -> usize
pub fn page_count(&self) -> usize
How many pages the filtered rows fill; at least one.
Sourcepub fn page_range(&self) -> Range<usize> ⓘ
pub fn page_range(&self) -> Range<usize> ⓘ
Positions of the current page’s rows among the filtered rows.
pub fn is_selectable(&self) -> bool
pub fn is_selected(&self, key: &Key) -> bool
Sourcepub fn page_check_state(&self) -> CheckState
pub fn page_check_state(&self) -> CheckState
The header checkbox: checked when every row on the page is selected, indeterminate when some are.
Sourcepub fn highlighted(&self) -> Option<&Key>
pub fn highlighted(&self) -> Option<&Key>
The row the keyboard acts on.
pub fn is_focused(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<Row, Key> Freeze for State<Row, Key>
impl<Row, Key> RefUnwindSafe for State<Row, Key>where
Vec<Row>: RefUnwindSafe,
Vec<Column<Row>>: RefUnwindSafe,
fn(&Row) -> Key: RefUnwindSafe,
HashSet<Key>: RefUnwindSafe,
Option<Key>: RefUnwindSafe,
impl<Row, Key> Send for State<Row, Key>
impl<Row, Key> Sync for State<Row, Key>
impl<Row, Key> Unpin for State<Row, Key>
impl<Row, Key> UnsafeUnpin for State<Row, Key>where
Vec<Row>: UnsafeUnpin,
Vec<Column<Row>>: UnsafeUnpin,
fn(&Row) -> Key: UnsafeUnpin,
HashSet<Key>: UnsafeUnpin,
Option<Key>: UnsafeUnpin,
impl<Row, Key> UnwindSafe for State<Row, Key>where
Vec<Row>: UnwindSafe,
Vec<Column<Row>>: UnwindSafe,
fn(&Row) -> Key: UnwindSafe,
HashSet<Key>: UnwindSafe,
Option<Key>: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.