pub struct State<T> { /* private fields */ }virtual-list only.Expand description
The items, the selection, the highlight and whether the list follows its end.
Implementations§
Source§impl<T> State<T>
impl<T> State<T>
Sourcepub fn new(items: impl IntoIterator<Item = T>) -> Self
pub fn new(items: impl IntoIterator<Item = T>) -> Self
A list in Mode::Single holding items.
pub fn with_mode(self, mode: Mode) -> Self
Sourcepub fn with_limit(self, limit: usize) -> Self
pub fn with_limit(self, limit: usize) -> Self
Keeps at most limit items, dropping the oldest as new ones
arrive. A limit of zero is treated as one.
Sourcepub fn with_follow(self, follow: bool) -> Self
pub fn with_follow(self, follow: bool) -> Self
Follows the end as items arrive, starting now. Scrolling away stops following, and scrolling back to the end or pressing End starts it again.
pub fn mode(&self) -> Mode
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get(&self, index: usize) -> Option<&T>
Sourcepub fn index(&self, id: RowId) -> Option<usize>
pub fn index(&self, id: RowId) -> Option<usize>
The index of the item with id, if it is still in the list.
pub fn is_selected(&self, index: usize) -> bool
Sourcepub fn highlighted(&self) -> Option<usize>
pub fn highlighted(&self) -> Option<usize>
The index the keyboard acts on.
pub fn is_focused(&self) -> bool
Sourcepub fn is_following(&self) -> bool
pub fn is_following(&self) -> bool
Whether the list is following its end.
Sourcepub fn extend(&mut self, items: impl IntoIterator<Item = T>)
pub fn extend(&mut self, items: impl IntoIterator<Item = T>)
Appends items, dropping the oldest when over the limit.
Sourcepub fn set_items(&mut self, items: impl IntoIterator<Item = T>)
pub fn set_items(&mut self, items: impl IntoIterator<Item = T>)
Replaces every item. The selection and highlight are cleared, and ids carry on from where the old items ended.
Sourcepub fn scroll_to(&mut self, index: usize)
pub fn scroll_to(&mut self, index: usize)
Scrolls the item at index into view without highlighting it. A
following list stops following unless it is the last item.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for State<T>
impl<T> RefUnwindSafe for State<T>where
VecDeque<T>: RefUnwindSafe,
impl<T> Send for State<T>
impl<T> Sync for State<T>
impl<T> Unpin for State<T>
impl<T> UnsafeUnpin for State<T>where
VecDeque<T>: UnsafeUnpin,
impl<T> UnwindSafe for State<T>where
VecDeque<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
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.